Trait AsyncWriteBuffer

Source
pub trait AsyncWriteBuffer: DerefMut<Target = [u8]> + Unpin {
    type Error;
    type WriteAll<'a>: Future<Output = Result<(), Self::Error>>
       where Self: 'a;

    // Required methods
    fn poll_alloc(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
    ) -> Poll<Result<(), Self::Error>>;
    fn write_all(&mut self, count: usize) -> Self::WriteAll<'_>;

    // Provided method
    fn alloc(&mut self) -> Alloc<'_, Self>  { ... }
}

Required Associated Types§

Source

type Error

Source

type WriteAll<'a>: Future<Output = Result<(), Self::Error>> where Self: 'a

Required Methods§

Source

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

Allocate some fixed amount of bytes in the buffer.

Source

fn write_all(&mut self, count: usize) -> Self::WriteAll<'_>

Send exactly count bytes from buffer. Remaining bytes are discarded.

Provided Methods§

Source

fn alloc(&mut self) -> Alloc<'_, Self>

Allocate some fixed amount of bytes in the buffer.

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§

Source§

impl<P: AsyncWrite + Unpin> AsyncWriteBuffer for IoBuffer<P>

Source§

type Error = Error

Source§

type WriteAll<'a> = WriteAll<'a, P> where P: 'a