pub trait VortexReadAt: 'static {
// Required methods
fn read_byte_range(
&self,
range: Range<u64>,
alignment: Alignment,
) -> impl Future<Output = Result<ByteBuffer>>;
fn size(&self) -> impl Future<Output = Result<u64>>;
// Provided method
fn performance_hint(&self) -> PerformanceHint { ... }
}
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_byte_range(
&self,
range: Range<u64>,
alignment: Alignment,
) -> impl Future<Output = Result<ByteBuffer>>
fn read_byte_range( &self, range: Range<u64>, alignment: Alignment, ) -> impl Future<Output = Result<ByteBuffer>>
Request an asynchronous positional read. Results will be returned as a ByteBuffer
.
If the reader does not have the requested number of bytes, the returned Future will complete
with an UnexpectedEof
.
§Thread Safety
The resultant Future need not be Send
, allowing implementations that use thread-per-core
executors.
Provided Methods§
fn performance_hint(&self) -> PerformanceHint
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.