Trait object::read::ReadCacheOps

source ·
pub trait ReadCacheOps {
    // Required methods
    fn len(&mut self) -> Result<u64, ()>;
    fn seek(&mut self, pos: u64) -> Result<u64, ()>;
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, ()>;
    fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ()>;
}
Expand description

Operations required to implement ReadCache.

This is a subset of the Read and Seek traits. A blanket implementation is provided for all types that implement Read + Seek.

Required Methods§

source

fn len(&mut self) -> Result<u64, ()>

Return the length of the stream.

Equivalent to std::io::Seek::seek(SeekFrom::End(0)).

source

fn seek(&mut self, pos: u64) -> Result<u64, ()>

Seek to the given position in the stream.

Equivalent to std::io::Seek::seek with SeekFrom::Start(pos).

source

fn read(&mut self, buf: &mut [u8]) -> Result<usize, ()>

Read up to buf.len() bytes into buf.

Equivalent to std::io::Read::read.

source

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ()>

Read exactly buf.len() bytes into buf.

Equivalent to std::io::Read::read_exact.

Implementors§

source§

impl<T: Read + Seek> ReadCacheOps for T