pub trait VortexReadAt:
Send
+ Sync
+ Clone
+ 'static {
// Required methods
fn read_at_into(
&self,
pos: u64,
buffer: BytesMut,
) -> impl Future<Output = Result<BytesMut>> + 'static;
fn size(&self) -> impl Future<Output = u64> + 'static;
// Provided method
fn performance_hint(&self) -> usize { ... }
}Expand description
A trait for types that support asynchronous reads.
References to the type must be safe to share across threads, but spawned
futures may be !Send to support thread-per-core implementations.
Readers must be cheaply cloneable to allow for easy sharing across tasks or threads.
Required Methods§
Sourcefn read_at_into(
&self,
pos: u64,
buffer: BytesMut,
) -> impl Future<Output = Result<BytesMut>> + 'static
fn read_at_into( &self, pos: u64, buffer: BytesMut, ) -> impl Future<Output = Result<BytesMut>> + 'static
Request an asynchronous positional read to be done, with results written into the provided buffer.
This method will take ownership of the provided buffer, and upon successful completion will return
the buffer completely full with data.
If the reader does not have enough data available to fill the buffer, the returned Future will complete
with an io::Error.
§Thread Safety
The resultant Future need not be Send, allowing implementations that use thread-per-core
executors.
Provided Methods§
fn performance_hint(&self) -> usize
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.