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
sourceimpl<'a, R: Read + Seek> ReadRef<'a> for &'a ReadCache<R>
impl<'a, R: Read + Seek> ReadRef<'a> for &'a ReadCache<R>
sourcefn 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 more
sourcefn 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 more
sourcefn 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 more
sourcefn 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 more
sourcefn 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 more
Auto 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more