Write

Trait Write 

Source
pub trait Write: Send {
    type Error: Error + ErrorAsErrorCode + Send + Sync + 'static;

    // Required method
    fn write(
        &mut self,
        buf: &[u8],
    ) -> impl Future<Output = Result<NonZeroUsize, Self::Error>> + Send;
}
Expand description

Write the data to a stream.

Required Associated Types§

Source

type Error: Error + ErrorAsErrorCode + Send + Sync + 'static

An error that can occur while writing to the stream.

Required Methods§

Source

fn write( &mut self, buf: &[u8], ) -> impl Future<Output = Result<NonZeroUsize, Self::Error>> + Send

Write the data from the given buffer into the stream, returning the amount of of bytes that were successfully written into the stream. If the returned amount is smaller than the size of the data that was being written, the user should try writing the remaining data again.

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.

Implementors§