object::read

Trait 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