Module futures_util::io
source Β· Expand description
Asynchronous I/O.
This module is the asynchronous version of std::io
. It defines four
traits, AsyncRead
, AsyncWrite
, AsyncSeek
, and AsyncBufRead
,
which mirror the Read
, Write
, Seek
, and BufRead
traits of the
standard library. However, these traits integrate with the asynchronous
task system, so that if an I/O object isnβt ready for reading (or writing),
the thread is not blocked, and instead the current task is queued to be
woken when I/O is ready.
In addition, the AsyncReadExt
, AsyncWriteExt
, AsyncSeekExt
, and
AsyncBufReadExt
extension traits offer a variety of useful combinators
for operating with asynchronous I/O objects, including ways to work with
them using futures, streams and sinks.
This module is only available when the std
feature of this
library is activated, and it is activated by default.
Re-exports§
pub use std::io::Error;
pub use std::io::ErrorKind;
pub use std::io::IoSlice;
pub use std::io::IoSliceMut;
pub use std::io::Result;
pub use std::io::SeekFrom;
Modules§
- allow_
std π - buf_
reader π - buf_
writer π - chain π
- close π
- copy π
- copy_
buf π - copy_
buf_ πabortable - cursor π
- empty π
- fill_
buf π - flush π
- into_
sink π - line_
writer π - lines π
- read π
- read_
exact π - read_
line π - read_
to_ πend - read_
to_ πstring - read_
until π - read_
vectored π - repeat π
- seek π
- sink π
- split π
- take π
- window π
- write π
- write_
all π - write_
vectored π
Structs§
- A simple wrapper type which allows types which implement only implement
std::io::Read
orstd::io::Write
to be used in contexts which expect anAsyncRead
orAsyncWrite
. - The
BufReader
struct adds buffering to any reader. - Wraps a writer and buffers its output.
- Reader for the
chain
method. - Future for the
close
method. - Future for the
copy()
function. - Future for the
copy_buf()
function. - Future for the
copy_buf_abortable()
function. - A
Cursor
wraps an in-memory buffer and provides it with aAsyncSeek
implementation. - Reader for the
empty()
function. - Future for the
fill_buf
method. - Future for the
flush
method. - Sink for the
into_sink
method. - Wrap a writer, like
BufWriter
does, but prioritizes buffering lines - Stream for the
lines
method. - Future for the
read
method. - Future for the
read_exact
method. - The readable half of an object returned from
AsyncRead::split
. - Future for the
read_line
method. - Future for the
read_to_end
method. - Future for the
read_to_string
method. - Future for the
read_until
method. - Future for the
read_vectored
method. - Reader for the
repeat()
function. - Error indicating a
ReadHalf<T>
andWriteHalf<T>
were not two halves of aAsyncRead + AsyncWrite
, and thus could not bereunite
d. - Future for the
BufReader::seek_relative
method. - Future for the
seek
method. - Writer for the
sink()
function. - Reader for the
take
method. - An owned window around an underlying buffer.
- Future for the
write
method. - Future for the
write_all
method. - The writable half of an object returned from
AsyncRead::split
. - Future for the
write_vectored
method.
Constants§
- DEFAUL
T_ πBUF_ SIZE
Traits§
- Read bytes asynchronously.
- An extension trait which adds utility methods to
AsyncBufRead
types. - Read bytes asynchronously.
- An extension trait which adds utility methods to
AsyncRead
types. - Seek bytes asynchronously.
- An extension trait which adds utility methods to
AsyncSeek
types. - Write bytes asynchronously.
- An extension trait which adds utility methods to
AsyncWrite
types.
Functions§
- assert_
read π - assert_
write π - Creates a future which copies all the bytes from one object to another.
- Creates a future which copies all the bytes from one object to another.
- Creates a future which copies all the bytes from one object to another, with its
AbortHandle
. - Constructs a new handle to an empty reader.
- initialize π βInitializes a buffer if necessary.
- Creates an instance of a reader that infinitely repeats one byte.
- Creates an instance of a writer which will successfully consume all data.