pub struct CachedSource<S: ByteSource> { /* private fields */ }Implementations§
Source§impl<S: ByteSource> CachedSource<S>
impl<S: ByteSource> CachedSource<S>
pub fn new(inner: S, block_size: u64, max_blocks: usize) -> Self
pub fn into_inner(self) -> S
pub fn block_size(&self) -> u64
Sourcepub fn cached_blocks(&self) -> usize
pub fn cached_blocks(&self) -> usize
How many blocks are resident. Tests and benchmarks read this; nothing else should.
Trait Implementations§
Source§impl<S: ByteSource> ByteSource for CachedSource<S>
impl<S: ByteSource> ByteSource for CachedSource<S>
Source§fn read_at(&self, offset: u64, len: usize) -> Result<Bytes>
fn read_at(&self, offset: u64, len: usize) -> Result<Bytes>
Read up to
len bytes at offset, returning fewer at end of file.Source§fn prefetch(&self, ranges: &[Range<u64>])
fn prefetch(&self, ranges: &[Range<u64>])
Announce ranges that are about to be read, so a source that can fetch
them together does. A no-op unless overridden. Read more
Source§fn close(&self)
fn close(&self)
Release the underlying handle. Idempotent; reads after it fail with
Error::Closed.fn is_empty(&self) -> Result<bool>
Auto Trait Implementations§
impl<S> !Freeze for CachedSource<S>
impl<S> !RefUnwindSafe for CachedSource<S>
impl<S> !UnwindSafe for CachedSource<S>
impl<S> Send for CachedSource<S>
impl<S> Sync for CachedSource<S>
impl<S> Unpin for CachedSource<S>where
S: Unpin,
impl<S> UnsafeUnpin for CachedSource<S>where
S: UnsafeUnpin,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more