pub trait FileReader: Send {
// Required methods
fn read<B: IoBufMut>(
&mut self,
buffer: B,
cancellation: &Cancellation,
) -> impl Future<Output = BufferResult<B>> + Send;
fn read_at<B: IoBufMut>(
&mut self,
buffer: B,
offset: u64,
cancellation: &Cancellation,
) -> impl Future<Output = BufferResult<B>> + Send;
fn close(&mut self) -> impl Future<Output = Result<()>> + Send;
// Provided methods
fn read_submit<B: IoBufMut>(
&mut self,
buffer: B,
cancellation: &Cancellation,
) -> impl Future<Output = Result<impl Future<Output = BufferResult<B>> + Send + 'static, (OperationError, B)>> + Send { ... }
fn read_at_submit<B: IoBufMut>(
&mut self,
buffer: B,
offset: u64,
cancellation: &Cancellation,
) -> impl Future<Output = Result<impl Future<Output = BufferResult<B>> + Send + 'static, (OperationError, B)>> + Send { ... }
}Expand description
Scheduler-bound, sequential access to a file’s readable direction. Construct through FileReading. Separate handles permit overlapping operations, but shared-cursor operations have no ordering guarantee across handles.
Required Methods§
Sourcefn read<B: IoBufMut>(
&mut self,
buffer: B,
cancellation: &Cancellation,
) -> impl Future<Output = BufferResult<B>> + Send
fn read<B: IoBufMut>( &mut self, buffer: B, cancellation: &Cancellation, ) -> impl Future<Output = BufferResult<B>> + Send
Read once at the file’s shared OS cursor, returning a possibly short count and the original owner on every result. Cancellation cannot roll back transferred bytes or cursor changes.
Sourcefn read_at<B: IoBufMut>(
&mut self,
buffer: B,
offset: u64,
cancellation: &Cancellation,
) -> impl Future<Output = BufferResult<B>> + Send
fn read_at<B: IoBufMut>( &mut self, buffer: B, offset: u64, cancellation: &Cancellation, ) -> impl Future<Output = BufferResult<B>> + Send
Read once at an explicit offset. Offsets must fit in i64. Unix implementations leave the shared cursor unchanged; Windows implementations may use seek_read, which changes it. The handle maintains no private cursor.
Sourcefn close(&mut self) -> impl Future<Output = Result<()>> + Send
fn close(&mut self) -> impl Future<Output = Result<()>> + Send
Stop admission and await accepted operation retirement without cancellation. Repeated close is safe; dropping a pending close is not a retirement barrier. This does not close the underlying file. Drop the retired handle before exclusive file close.
Provided Methods§
Sourcefn read_submit<B: IoBufMut>(
&mut self,
buffer: B,
cancellation: &Cancellation,
) -> impl Future<Output = Result<impl Future<Output = BufferResult<B>> + Send + 'static, (OperationError, B)>> + Send
fn read_submit<B: IoBufMut>( &mut self, buffer: B, cancellation: &Cancellation, ) -> impl Future<Output = Result<impl Future<Output = BufferResult<B>> + Send + 'static, (OperationError, B)>> + Send
Await admission separately from collecting the original owner. Accepted work can complete independently of polling the returned future. The fallback completes the ordinary operation before returning; backends can admit independently progressing work earlier. Pre-cancellation rejects admission and returns the unchanged owner.
Sourcefn read_at_submit<B: IoBufMut>(
&mut self,
buffer: B,
offset: u64,
cancellation: &Cancellation,
) -> impl Future<Output = Result<impl Future<Output = BufferResult<B>> + Send + 'static, (OperationError, B)>> + Send
fn read_at_submit<B: IoBufMut>( &mut self, buffer: B, offset: u64, cancellation: &Cancellation, ) -> impl Future<Output = Result<impl Future<Output = BufferResult<B>> + Send + 'static, (OperationError, B)>> + Send
Await admission separately from collecting the original owner. Accepted work can complete independently of polling the returned future. The fallback completes the ordinary operation before returning; backends can admit independently progressing work earlier. Pre-cancellation rejects admission and returns the unchanged owner.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".