AsyncWrite

Trait AsyncWrite 

pub trait AsyncWrite {
    // Required methods
    async fn write<T>(&mut self, buf: T) -> BufResult<usize, T>
       where T: IoBuf;
    async fn flush(&mut self) -> Result<(), Error>;
    async fn shutdown(&mut self) -> Result<(), Error>;

    // Provided method
    async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>
       where T: IoVectoredBuf { ... }
}
Available on crate feature io only.
Expand description

§AsyncWrite

Async write with a ownership of a buffer

Required Methods§

async fn write<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBuf,

Write some bytes from the buffer into this source and return a BufResult, consisting of the buffer and a usize indicating how many bytes were written.

async fn flush(&mut self) -> Result<(), Error>

Attempts to flush the object, ensuring that any buffered data reach their destination.

async fn shutdown(&mut self) -> Result<(), Error>

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down.

Provided Methods§

async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoVectoredBuf,

Like write, except that it write bytes from a buffer implements IoVectoredBuf into the source.

The default implementation will write from the first buffers with non-zero buf_len, meaning it’s possible and likely that not all contents are written. If guaranteed full write is desired, it is recommended to use AsyncWriteExt::write_vectored_all instead.

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.

Implementations on Foreign Types§

§

impl AsyncWrite for &mut [u8]

§

async fn write<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBuf,

§

async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoVectoredBuf,

§

async fn flush(&mut self) -> Result<(), Error>

§

async fn shutdown(&mut self) -> Result<(), Error>

§

impl<A> AsyncWrite for &mut A
where A: AsyncWrite + ?Sized,

§

async fn write<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBuf,

§

async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoVectoredBuf,

§

async fn flush(&mut self) -> Result<(), Error>

§

async fn shutdown(&mut self) -> Result<(), Error>

§

impl<A> AsyncWrite for Cursor<A>
where A: AsyncWriteAt,

§

async fn write<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBuf,

§

async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoVectoredBuf,

§

async fn flush(&mut self) -> Result<(), Error>

§

async fn shutdown(&mut self) -> Result<(), Error>

Implementors§

Source§

impl AsyncWrite for &Sender

§

impl AsyncWrite for &TcpStream

§

impl AsyncWrite for &UnixStream

Source§

impl AsyncWrite for Sender

Source§

impl AsyncWrite for Stderr

Source§

impl AsyncWrite for Stdout

§

impl AsyncWrite for TcpStream

§

impl AsyncWrite for UnixStream

§

impl AsyncWrite for ChildStdin

Source§

impl AsyncWrite for SendStream

§

impl AsyncWrite for Null

§

impl<A> AsyncWrite for Vec<u8, A>
where A: Allocator,

Write is implemented for Vec<u8> by appending to the vector. The vector will grow as needed.

Source§

impl<S> AsyncWrite for MaybeTlsStream<S>
where S: AsyncRead + AsyncWrite + Unpin + 'static,

Source§

impl<S> AsyncWrite for TlsStream<S>
where S: AsyncRead + AsyncWrite + 'static,

Source§

impl<T> AsyncWrite for &AsyncFd<T>
where T: AsFd + 'static,

Source§

impl<T> AsyncWrite for AsyncFd<T>
where T: AsFd + 'static,

§

impl<T> AsyncWrite for OwnedWriteHalf<T>
where &'a T: for<'a> AsyncWrite,

§

impl<T> AsyncWrite for compio::net::WriteHalf<'_, T>
where &'a T: for<'a> AsyncWrite,

§

impl<T> AsyncWrite for compio::io::util::split::WriteHalf<T>
where T: AsyncWrite,

§

impl<W> AsyncWrite for BufWriter<W>
where W: AsyncWrite,

§

impl<W, A> AsyncWrite for Box<W, A>
where W: AsyncWrite + ?Sized, A: Allocator,