Trait AsyncStreamWriter

Source
pub trait AsyncStreamWriter {
    // Required methods
    fn write(&mut self, data: &[u8]) -> impl Future<Output = Result<()>>;
    fn write_bytes(&mut self, data: Bytes) -> impl Future<Output = Result<()>>;
    fn sync(&mut self) -> impl Future<Output = Result<()>>;
}
Expand description

A non seekable writer, e.g. a network socket.

Required Methods§

Source

fn write(&mut self, data: &[u8]) -> impl Future<Output = Result<()>>

Write the entire slice.

In case of an error, some bytes may have been written.

Source

fn write_bytes(&mut self, data: Bytes) -> impl Future<Output = Result<()>>

Write the entire bytes.

In case of an error, some bytes may have been written.

Source

fn sync(&mut self) -> impl Future<Output = Result<()>>

Sync any buffers to the underlying storage.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AsyncStreamWriter for Vec<u8>

Source§

async fn write(&mut self, data: &[u8]) -> Result<()>

Source§

async fn write_bytes(&mut self, data: Bytes) -> Result<()>

Source§

async fn sync(&mut self) -> Result<()>

Source§

impl AsyncStreamWriter for BytesMut

Source§

async fn write(&mut self, data: &[u8]) -> Result<()>

Source§

async fn write_bytes(&mut self, data: Bytes) -> Result<()>

Source§

async fn sync(&mut self) -> Result<()>

Source§

impl<T: AsyncStreamWriter> AsyncStreamWriter for &mut T

Source§

async fn write(&mut self, data: &[u8]) -> Result<()>

Source§

async fn sync(&mut self) -> Result<()>

Source§

async fn write_bytes(&mut self, data: Bytes) -> Result<()>

Implementors§