pub trait MassMapReader {
// Required method
fn read_exact_at<F, R>(&self, offset: u64, length: u64, f: F) -> Result<R>
where F: Fn(&[u8]) -> Result<R>;
// Provided method
fn batch_read_at<Q: ?Sized, F, R>(
&self,
iov: impl IntoIterator<Item = (impl Borrow<Q>, u64, u64)>,
f: F,
) -> Result<Vec<R>>
where F: Fn(&Q, &[u8]) -> Result<R> { ... }
}Expand description
Trait abstracting read access to massmap files.
Implementations must support positional reads without mutating shared state.
The trait is blanket-implemented for platform-specific FileExt handles,
but can also wrap memory-mapped regions or networked block stores. Override
batch_read_at to surface vectored IO capabilities.
Required Methods§
Provided Methods§
Sourcefn batch_read_at<Q: ?Sized, F, R>(
&self,
iov: impl IntoIterator<Item = (impl Borrow<Q>, u64, u64)>,
f: F,
) -> Result<Vec<R>>
fn batch_read_at<Q: ?Sized, F, R>( &self, iov: impl IntoIterator<Item = (impl Borrow<Q>, u64, u64)>, f: F, ) -> Result<Vec<R>>
Reads multiple ranges in sequence, delegating to read_exact_at.
Override this method to take advantage of vectored IO when available.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<T: FileExt> MassMapReader for T
Available on Unix only.