pub trait AsyncFile: Send {
// Required methods
fn write_all<'a>(
&'a mut self,
buf: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>;
fn read_exact<'a>(
&'a mut self,
buf: &'a mut [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>;
fn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'a>>;
fn seek<'a>(
&'a mut self,
pos: SeekFrom,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'a>>;
fn sync_all(&self) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
fn shutdown(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
}Expand description
Async file trait.
Required Methods§
Sourcefn write_all<'a>(
&'a mut self,
buf: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
fn write_all<'a>( &'a mut self, buf: &'a [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
Write all bytes to the file.
Sourcefn read_exact<'a>(
&'a mut self,
buf: &'a mut [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
fn read_exact<'a>( &'a mut self, buf: &'a mut [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
Read to fill the buffer exactly.
Sourcefn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'a>>
fn read_to_end<'a>( &'a mut self, buf: &'a mut Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'a>>
Read all bytes into a vector.
Sourcefn seek<'a>(
&'a mut self,
pos: SeekFrom,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'a>>
fn seek<'a>( &'a mut self, pos: SeekFrom, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'a>>
Seek to a position.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".