Struct futures_util::io::AllowStdIo [−][src]
pub struct AllowStdIo<T>(_);
Expand description
A simple wrapper type which allows types which implement only
implement std::io::Read
or std::io::Write
to be used in contexts which expect an AsyncRead
or AsyncWrite
.
If these types issue an error with the kind io::ErrorKind::WouldBlock
,
it is expected that they will notify the current task on readiness.
Synchronous std
types should not issue errors of this kind and
are safe to use in this context. However, using these types with
AllowStdIo
will cause the event loop to block, so they should be used
with care.
Implementations
Consumes self and returns the contained IO object.
Trait Implementations
Attempt to return the contents of the internal buffer, filling it with more data from the inner reader if it is empty. Read more
Attempt to read from the AsyncRead
into buf
. Read more
Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty. Read more
Tells this buffer that amt
bytes have been consumed from the buffer,
so they should no longer be returned in calls to read
. Read more
buf_read_has_data_left
)Check if the underlying Read
has any data left to be read. Read more
Read all bytes into buf
until the delimiter byte
or EOF is reached. Read more
Read all bytes until a newline (the 0xA
byte) is reached, and append
them to the provided buffer. Read more
Returns an iterator over the contents of this reader split on the byte
byte
. Read more
fn clone(&self) -> AllowStdIo<T>ⓘNotable traits for AllowStdIo<T>impl<T> Read for AllowStdIo<T> where
T: Read, impl<T> Write for AllowStdIo<T> where
T: Write,
fn clone(&self) -> AllowStdIo<T>ⓘNotable traits for AllowStdIo<T>impl<T> Read for AllowStdIo<T> where
T: Read, impl<T> Write for AllowStdIo<T> where
T: Write,
impl<T> Read for AllowStdIo<T> where
T: Read, impl<T> Write for AllowStdIo<T> where
T: Write,
Returns a copy of the value. Read more
Performs copy-assignment from source
. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Like read
, except that it reads into a slice of buffers. Read more
Read all bytes until EOF in this source, placing them into buf
. Read more
Read all bytes until EOF in this source, appending them to buf
. Read more
Read the exact number of bytes required to fill buf
. Read more
can_vector
)Determines if this Read
er has an efficient read_vectored
implementation. Read more
read_initializer
)Determines if this Read
er can work with buffers of uninitialized
memory. Read more
Creates a “by reference” adapter for this instance of Read
. Read more
Creates an adapter which will chain this stream with another. Read more
Write a buffer into this writer, returning how many bytes were written. Read more
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Attempts to write an entire buffer into this writer. Read more
Writes a formatted string into this writer, returning any error encountered. Read more
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for AllowStdIo<T> where
T: RefUnwindSafe,
impl<T> Send for AllowStdIo<T> where
T: Send,
impl<T> Sync for AllowStdIo<T> where
T: Sync,
impl<T> UnwindSafe for AllowStdIo<T> where
T: UnwindSafe,
Blanket Implementations
Creates a future which will wait for a non-empty buffer to be available from this I/O object or EOF to be reached. Read more
A convenience for calling AsyncBufRead::consume
on Unpin
IO types. Read more
Creates a future which will read all the bytes associated with this I/O
object into buf
until the delimiter byte
or EOF is reached.
This method is the async equivalent to BufRead::read_until
. Read more
Creates a future which will read all the bytes associated with this I/O
object into buf
until a newline (the 0xA byte) or EOF is reached,
This method is the async equivalent to BufRead::read_line
. Read more
Creates an adaptor which will chain this stream with another. Read more
Tries to read some bytes directly into the given buf
in asynchronous
manner, returning a future type. Read more
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectored<'a, Self>ⓘNotable traits for ReadVectored<'_, R>impl<R: AsyncRead + ?Sized + Unpin> Future for ReadVectored<'_, R> type Output = Result<usize>;
where
Self: Unpin,
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectored<'a, Self>ⓘNotable traits for ReadVectored<'_, R>impl<R: AsyncRead + ?Sized + Unpin> Future for ReadVectored<'_, R> type Output = Result<usize>;
where
Self: Unpin,
impl<R: AsyncRead + ?Sized + Unpin> Future for ReadVectored<'_, R> type Output = Result<usize>;
Creates a future which will read from the AsyncRead
into bufs
using vectored
IO operations. Read more
Creates a future which will read exactly enough bytes to fill buf
,
returning an error if end of file (EOF) is hit sooner. Read more
Creates a future which will read all the bytes from this AsyncRead
. Read more
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String
) -> ReadToString<'a, Self>ⓘNotable traits for ReadToString<'_, A>impl<A> Future for ReadToString<'_, A> where
A: AsyncRead + ?Sized + Unpin, type Output = Result<usize>;
where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String
) -> ReadToString<'a, Self>ⓘNotable traits for ReadToString<'_, A>impl<A> Future for ReadToString<'_, A> where
A: AsyncRead + ?Sized + Unpin, type Output = Result<usize>;
where
Self: Unpin,
impl<A> Future for ReadToString<'_, A> where
A: AsyncRead + ?Sized + Unpin, type Output = Result<usize>;
Creates a future which will read all the bytes from this AsyncRead
. Read more
Helper method for splitting this read/write object into two halves. Read more
Creates a future which will seek an IO object, and then yield the new position in the object and the object itself. Read more
Creates a future which will entirely flush this AsyncWrite
. Read more
Creates a future which will entirely close this AsyncWrite
.
Creates a future which will write bytes from buf
into the object. Read more
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self>ⓘNotable traits for WriteVectored<'_, W>impl<W: AsyncWrite + ?Sized + Unpin> Future for WriteVectored<'_, W> type Output = Result<usize>;
where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self>ⓘNotable traits for WriteVectored<'_, W>impl<W: AsyncWrite + ?Sized + Unpin> Future for WriteVectored<'_, W> type Output = Result<usize>;
where
Self: Unpin,
impl<W: AsyncWrite + ?Sized + Unpin> Future for WriteVectored<'_, W> type Output = Result<usize>;
Creates a future which will write bytes from bufs
into the object using vectored
IO operations. Read more
Write data into this object. Read more
Mutably borrows from an owned value. Read more