AsyncFrameWrite

Trait AsyncFrameWrite 

Source
pub trait AsyncFrameWrite: Send + 'static {
    // Required method
    fn poll_write(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: &mut FrameReader<'_>,
    ) -> Poll<Result<()>>;

    // Provided methods
    fn begin_write_frame(self: Pin<&mut Self>, len: usize) -> Result<()> { ... }
    fn poll_flush(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
    ) -> Poll<Result<()>> { ... }
    fn poll_close(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
    ) -> Poll<Result<()>> { ... }
}

Required Methods§

Source

fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut FrameReader<'_>, ) -> Poll<Result<()>>

Write a frame to the underlying transport. It can be called multiple times to write a single frame. In this case, the input buffer should be advanced accordingly.

Provided Methods§

Source

fn begin_write_frame(self: Pin<&mut Self>, len: usize) -> Result<()>

Called before writing a frame. This can be used to deal with writing cancellation.

Source

fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

Flush the underlying transport.

Source

fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>

Close the underlying transport.

Implementors§

Source§

impl AsyncFrameWrite for InMemoryWriter

Source§

impl<T> AsyncFrameWrite for T
where T: AsyncWrite + Send + 'static,

Futures adaptor for [AsyncWriteFrame]