Skip to main content

StreamWriter

Trait StreamWriter 

Source
pub trait StreamWriter<'a> {
    type Input: 'a;
    type Info;

    // Required methods
    fn info(&self) -> &Self::Info;
    fn write(
        &self,
        input: Self::Input,
    ) -> impl Future<Output = StreamResult<()>> + Send;
    fn close(self) -> impl Future<Output = StreamResult<()>> + Send;
    fn close_with_reason(
        self,
        reason: &str,
    ) -> impl Future<Output = StreamResult<()>> + Send;
}
Expand description

Writer for an open data stream.

Required Associated Types§

Source

type Input: 'a

Type of input this writer accepts.

Source

type Info

Information about the underlying data stream.

Required Methods§

Source

fn info(&self) -> &Self::Info

Returns a reference to the stream info.

Source

fn write( &self, input: Self::Input, ) -> impl Future<Output = StreamResult<()>> + Send

Writes to the stream.

Source

fn close(self) -> impl Future<Output = StreamResult<()>> + Send

Closes the stream normally.

Source

fn close_with_reason( self, reason: &str, ) -> impl Future<Output = StreamResult<()>> + Send

Closes the stream abnormally, specifying the reason for closure.

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§