pub trait ReadFile: Send + Sync {
// Required methods
fn read_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, FileError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_range<'life0, 'async_trait>(
&'life0 self,
offset: u64,
length: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, FileError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn native_metadata(&self) -> Option<Metadata> { ... }
fn byte_len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, FileError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Read capability bound to one opened file, even if its path is replaced. Implementations serialize cursor access and return errors on short ranges.
Required Methods§
fn read_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, FileError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_range<'life0, 'async_trait>(
&'life0 self,
offset: u64,
length: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, FileError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
Sourcefn native_metadata(&self) -> Option<Metadata>
fn native_metadata(&self) -> Option<Metadata>
Metadata of the opened native handle, when available.
Sourcefn byte_len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, FileError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn byte_len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, FileError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Current byte length of this opened generation, when supported. This is not a snapshot: later appends or truncation may change the length.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".