Trait completion_io::AsyncWriteWith[][src]

pub trait AsyncWriteWith<'a> {
    type WriteFuture: CompletionFuture<Output = Result<usize>>;
    type WriteVectoredFuture: CompletionFuture<Output = Result<usize>>;
    type FlushFuture: CompletionFuture<Output = Result<()>>;
    fn write(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture;
fn write_vectored(
        &'a mut self,
        bufs: &'a [IoSlice<'a>]
    ) -> Self::WriteVectoredFuture;
fn flush(&'a mut self) -> Self::FlushFuture; fn is_write_vectored(&self) -> bool { ... } }

Write bytes to a source asynchronously with a specific lifetime.

Associated Types

type WriteFuture: CompletionFuture<Output = Result<usize>>[src]

The future that writes to the source, and outputs the number of bytes written.

type WriteVectoredFuture: CompletionFuture<Output = Result<usize>>[src]

The future that writes a vector of buffers to the source, and outputs the number of bytes written. If your writer does not have efficient vectored writes, set this to DefaultWriteVectored<'a, Self>.

type FlushFuture: CompletionFuture<Output = Result<()>>[src]

The future that flushes the output stream.

Loading content...

Required methods

fn write(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture[src]

Write a buffer to the writer, returning how many bytes were written.

fn write_vectored(
    &'a mut self,
    bufs: &'a [IoSlice<'a>]
) -> Self::WriteVectoredFuture
[src]

Like write, except that it writes from a slice of buffers.

Data is copied from each buffer in order, with the final buffer read from possibly being only partially consumed. This method must behave as a call to write with the buffers concatenated would.

If your writer does not have efficient vectored writes, call DefaultWriteVectored::new(self, bufs).

fn flush(&'a mut self) -> Self::FlushFuture[src]

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.

Loading content...

Provided methods

fn is_write_vectored(&self) -> bool[src]

Determines if this AsyncWriter has an efficient write_vectored implementation.

The default implementation returns false.

Loading content...

Implementations on Foreign Types

impl<'a, W: AsyncWriteWith<'a> + ?Sized> AsyncWriteWith<'a> for &mut W[src]

type WriteFuture = W::WriteFuture

type WriteVectoredFuture = W::WriteVectoredFuture

type FlushFuture = W::FlushFuture

impl<'a, W: AsyncWriteWith<'a> + ?Sized> AsyncWriteWith<'a> for Box<W>[src]

type WriteFuture = W::WriteFuture

type WriteVectoredFuture = W::WriteVectoredFuture

type FlushFuture = W::FlushFuture

impl<'a> AsyncWriteWith<'a> for Sink[src]

type WriteFuture = Ready<Result<usize>>

type WriteVectoredFuture = Ready<Result<usize>>

type FlushFuture = Ready<Result<()>>

impl<'a> AsyncWriteWith<'a> for &Sink[src]

type WriteFuture = Ready<Result<usize>>

type WriteVectoredFuture = Ready<Result<usize>>

type FlushFuture = Ready<Result<()>>

impl<'a, 's> AsyncWriteWith<'a> for &'s mut [u8][src]

type WriteFuture = WriteSlice<'a, 's>

type WriteVectoredFuture = WriteVectoredSlice<'a, 's>

type FlushFuture = Ready<Result<()>>

impl<'a> AsyncWriteWith<'a> for Vec<u8>[src]

type WriteFuture = WriteVec<'a>

type WriteVectoredFuture = WriteVectoredVec<'a>

type FlushFuture = Ready<Result<()>>

Loading content...

Implementors

Loading content...