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.

Object Safety§

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§