Skip to main content

Sink

Trait Sink 

Source
pub trait Sink:
    Index
    + Send
    + 'static {
    // Required methods
    fn write_future<T>(
        self,
        offset: usize,
        item: impl Future<Output = T> + Send + 'static,
    ) -> impl Future<Output = Result<()>> + Send
       where T: Encode<Self>,
             Error: From<<T::Encoder as Encoder<T>>::Error>;
    fn write_stream<T>(
        self,
        offset: usize,
        items: impl Stream<Item = Vec<T>> + Send + Unpin + 'static,
    ) -> impl Future<Output = Result<()>> + Send
       where T: Encode<Self> + Send + 'static,
             Error: From<<T::Encoder as Encoder<T>>::Error>;
    fn write_stream_bytes(
        self,
        offset: usize,
        items: impl Stream<Item = Bytes> + Send + Unpin + 'static,
    ) -> impl Future<Output = Result<()>> + Send;
    fn write_stream_read(
        self,
        offset: usize,
        ready: BytesMut,
        items: impl AsyncRead + Send + Unpin + 'static,
    ) -> impl Future<Output = Result<()>> + Send;
}
Expand description

Target of deferred transmission of asynchronous values, encoded by Encode

offset is the position of the byte written by the encoder of the asynchronous value in the buffer the value was encoded into.

Required Methods§

Source

fn write_future<T>( self, offset: usize, item: impl Future<Output = T> + Send + 'static, ) -> impl Future<Output = Result<()>> + Send
where T: Encode<Self>, Error: From<<T::Encoder as Encoder<T>>::Error>,

Transmits the value of a future<T>

Source

fn write_stream<T>( self, offset: usize, items: impl Stream<Item = Vec<T>> + Send + Unpin + 'static, ) -> impl Future<Output = Result<()>> + Send
where T: Encode<Self> + Send + 'static, Error: From<<T::Encoder as Encoder<T>>::Error>,

Transmits the elements of a stream<T>

Source

fn write_stream_bytes( self, offset: usize, items: impl Stream<Item = Bytes> + Send + Unpin + 'static, ) -> impl Future<Output = Result<()>> + Send

Transmits the elements of a stream<u8> from a Stream of Bytes

Source

fn write_stream_read( self, offset: usize, ready: BytesMut, items: impl AsyncRead + Send + Unpin + 'static, ) -> impl Future<Output = Result<()>> + Send

Transmits the elements of a stream<u8> from ready followed by an AsyncRead

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§