pub trait FileWrite:
Send
+ Unpin
+ 'static {
// Required methods
fn write<'life0, 'async_trait>(
&'life0 mut self,
bs: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<FileMetadata>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for writing file.
§TODO
It’s possible for us to remove the async_trait, but we need to figure out how to handle the object safety.
Required Methods§
Sourcefn write<'life0, 'async_trait>(
&'life0 mut self,
bs: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write<'life0, 'async_trait>(
&'life0 mut self,
bs: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Write bytes to file.
TODO: we can support writing non-contiguous bytes in the future.
Sourcefn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<FileMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<FileMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the file and return its stored size, including encryption overhead for encrypted files.
Calling close on closed file will generate an error.