pub trait Write: Unpin + Send + Sync {
// 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 append<'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<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Write is the trait that OpenDAL returns to callers.
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 whole content at once.
To append multiple bytes together, use append
instead.
sourcefn append<'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 append<'life0, 'async_trait>( &'life0 mut self, bs: Bytes ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Append bytes to the writer.
It is highly recommended to align the length of the input bytes into blocks of 4MiB (except the last block) for better performance and compatibility.
Implementations on Foreign Types§
source§impl Write for ()
impl Write for ()
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 append<'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<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
source§impl<T: Write + ?Sized> Write for Box<T>
impl<T: Write + ?Sized> Write for Box<T>
Box<dyn Write>
won’t implement Write
automatically. To make Writer
work as expected, we must add this impl.