Skip to main content

AsyncWrite

Trait AsyncWrite 

Source
pub trait AsyncWrite {
    type Error;

    // Required methods
    fn write<'a>(
        &'a mut self,
        buf: &'a [u8],
    ) -> impl Future<Output = Result<usize, Self::Error>>;
    fn flush(&mut self) -> impl Future<Output = Result<(), Self::Error>>;
}
Expand description

A stream that can be written to asynchronously.

Required Associated Types§

Source

type Error

The error returned by write and flush.

Required Methods§

Source

fn write<'a>( &'a mut self, buf: &'a [u8], ) -> impl Future<Output = Result<usize, Self::Error>>

Writes from a given buffer, returns the number of written bytes.

§Errors

Returns an error if writing fails.

§Cancel safety

Implementations in this crate are cancel safe.

Source

fn flush(&mut self) -> impl Future<Output = Result<(), Self::Error>>

Makes sure that everything accepted by write is sent.

§Errors

Returns an error if writing fails.

§Cancel safety

Implementations in this crate are cancel safe.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<const FDS: usize> AsyncWrite for BorrowedWriteHalf<'_, '_, FDS>

Source§

impl<const FDS: usize> AsyncWrite for TcpStream<'_, FDS>

Source§

impl<const FDS: usize> AsyncWrite for UnixStream<'_, FDS>