Trait futures_util::io::AsyncWriteExt
[−]
[src]
pub trait AsyncWriteExt: AsyncWrite { fn flush(self) -> Flush<Self>
where
Self: Sized, { ... } fn close(self) -> Close<Self>
where
Self: Sized, { ... } fn write_all<T>(self, buf: T) -> WriteAll<Self, T>
where
T: AsRef<[u8]>,
Self: Sized, { ... } }
An extension trait which adds utility methods to AsyncWrite
types.
Provided Methods
fn flush(self) -> Flush<Self> where
Self: Sized,
Self: Sized,
Creates a future which will entirely flush this AsyncWrite
and then return self
.
This function will consume self
if an error occurs.
fn close(self) -> Close<Self> where
Self: Sized,
Self: Sized,
Creates a future which will entirely close this AsyncWrite
and then return self
.
This function will consume the object provided if an error occurs.
fn write_all<T>(self, buf: T) -> WriteAll<Self, T> where
T: AsRef<[u8]>,
Self: Sized,
T: AsRef<[u8]>,
Self: Sized,
Write a Buf
into this value, returning how many bytes were written.
Creates a future that will write the entire contents of the buffer buf
into
this AsyncWrite
.
The returned future will not complete until all the data has been written.
The future will resolve to a tuple of self
and buf
(so the buffer can be reused as needed).
Any error which happens during writing will cause both the stream and the buffer to be destroyed.
The buf
parameter here only requires the AsRef<[u8]>
trait, which should
be broadly applicable to accepting data which can be converted to a slice.
The Window
struct is also available in this crate to provide a different
window into a slice if necessary.
Implementors
impl<T: AsyncWrite + ?Sized> AsyncWriteExt for T