Module futures_lite::io

source ·
Expand description

Tools and combinators for I/O.


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?;





  • 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 Aliases§

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