Module futures_lite::io
source · Expand description
Tools and combinators for I/O.
Examples
use futures_lite::io::{self, AsyncReadExt};
let input: &[u8] = b"hello";
let mut reader = io::BufReader::new(input);
let mut contents = String::new();
reader.read_to_string(&mut contents).await?;
Re-exports
pub use std::io::Error;
pub use std::io::ErrorKind;
pub use std::io::Result;
pub use std::io::SeekFrom;
pub use futures_io::AsyncBufRead;
pub use futures_io::AsyncRead;
pub use futures_io::AsyncSeek;
pub use futures_io::AsyncWrite;
Structs
- Asserts that a type implementing
std::io
traits can be used as an async type. - A wrapper around a type that implements
AsyncRead
orAsyncWrite
that convertsPending
polls toWouldBlock
errors. - Blocks on all async I/O operations and implements
std::io
traits. - Adds buffering to a reader.
- Adds buffering to a writer.
- Reader for the
AsyncReadExt::bytes()
method. - Reader for the
AsyncReadExt::chain()
method. - Future for the
AsyncWriteExt::close()
method. - Gives an in-memory buffer a cursor for reading and writing.
- Reader for the
empty()
function. - Future for the
AsyncBufReadExt::fill_buf()
method. - Future for the
AsyncWriteExt::flush()
method. - Stream for the
AsyncBufReadExt::lines()
method. - Future for the
AsyncReadExt::read_exact()
method. - Future for the
AsyncReadExt::read()
method. - The read half returned by
split()
. - Future for the
AsyncBufReadExt::read_line()
method. - Future for the
AsyncReadExt::read_to_end()
method. - Future for the
AsyncReadExt::read_to_string()
method. - Future for the
AsyncBufReadExt::read_until()
method. - Future for the
AsyncReadExt::read_vectored()
method. - Reader for the
repeat()
function. - Future for the
AsyncSeekExt::seek()
method. - Writer for the
sink()
function. - Stream for the
AsyncBufReadExt::split()
method. - Reader for the
AsyncReadExt::take()
method. - Future for the
AsyncWriteExt::write_all()
method. - Future for the
AsyncWriteExt::write()
method. - The write half returned by
split()
. - Future for the
AsyncWriteExt::write_vectored()
method.
Traits
- Extension trait for
AsyncBufRead
. - Extension trait for
AsyncRead
. - Extension trait for
AsyncSeek
. - Extension trait for
AsyncWrite
.
Functions
- Copies the entire contents of a reader into a writer.
- Creates an empty reader.
- Creates an infinite reader that reads the same byte repeatedly.
- Creates a writer that consumes and drops all data.
- Splits a stream into
AsyncRead
andAsyncWrite
halves.
Type Aliases
- Type alias for
Pin<Box<dyn AsyncRead + Send + 'static>>
. - Type alias for
Pin<Box<dyn AsyncWrite + Send + 'static>>
.