pub struct ReadCache<R: Read + Seek> { /* private fields */ }
Expand description
An implementation of ReadRef
for data in a stream that implements
Read + Seek
.
Contains a cache of read-only blocks of data, allowing references to them to be returned. Entries in the cache are never removed. Entries are keyed on the offset and size of the read. Currently overlapping reads are considered separate reads.
Implementations§
Trait Implementations§
source§impl<'a, R: Read + Seek> ReadRef<'a> for &'a ReadCache<R>
impl<'a, R: Read + Seek> ReadRef<'a> for &'a ReadCache<R>
source§fn read_bytes_at(self, offset: u64, size: u64) -> Result<&'a [u8], ()>
fn read_bytes_at(self, offset: u64, size: u64) -> Result<&'a [u8], ()>
Get a reference to a
u8
slice at the given offset. Read moresource§fn read_bytes_at_until(
self,
range: Range<u64>,
delimiter: u8
) -> Result<&'a [u8], ()>
fn read_bytes_at_until( self, range: Range<u64>, delimiter: u8 ) -> Result<&'a [u8], ()>
Get a reference to a delimited
u8
slice which starts at range.start. Read moresource§fn read_bytes(self, offset: &mut u64, size: u64) -> Result<&'a [u8], ()>
fn read_bytes(self, offset: &mut u64, size: u64) -> Result<&'a [u8], ()>
Get a reference to a
u8
slice at the given offset, and update the offset. Read moresource§fn read<T: Pod>(self, offset: &mut u64) -> Result<&'a T, ()>
fn read<T: Pod>(self, offset: &mut u64) -> Result<&'a T, ()>
Get a reference to a
Pod
type at the given offset, and update the offset. Read moresource§fn read_at<T: Pod>(self, offset: u64) -> Result<&'a T, ()>
fn read_at<T: Pod>(self, offset: u64) -> Result<&'a T, ()>
Get a reference to a
Pod
type at the given offset. Read moreAuto Trait Implementations§
impl<R> !RefUnwindSafe for ReadCache<R>
impl<R> Send for ReadCache<R>where R: Send,
impl<R> !Sync for ReadCache<R>
impl<R> Unpin for ReadCache<R>where R: Unpin,
impl<R> UnwindSafe for ReadCache<R>where R: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more