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.

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() method.

The read half returned by split().

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() method.

The write half returned by split().

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 and AsyncWrite halves.

Type Definitions

Type alias for Pin<Box<dyn AsyncRead + Send + 'static>>.

Type alias for Pin<Box<dyn AsyncWrite + Send + 'static>>.