Skip to main content

WritableStream

Trait WritableStream 

Source
pub trait WritableStream: Send {
    // Required methods
    fn write(
        &mut self,
        buffer: &[u8],
        cancellation: &Cancellation,
    ) -> impl Future<Output = OperationResult<usize>> + Send;
    fn flush(
        &mut self,
        cancellation: &Cancellation,
    ) -> impl Future<Output = OperationResult<()>> + Send;
    fn close(&mut self) -> impl Future<Output = Result<()>> + Send;
}
Expand description

An ordered output direction. Accepted bytes must not be replayed after a cancelled flush; flush establishes delivery to the underlying transport.

Required Methods§

Source

fn write( &mut self, buffer: &[u8], cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<usize>> + Send

Accept a possibly short prefix, reporting progress before another wait.

Source

fn flush( &mut self, cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<()>> + Send

Deliver all previously accepted bytes, without closing the direction.

Source

fn close(&mut self) -> impl Future<Output = Result<()>> + Send

Retire this direction. Flush first when delivery is required.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§