[−][src]Module futures_lite::io
Tools and combinators for I/O.
Examples
Read a file line by line:
use blocking::{block_on, Unblock}; use futures_lite::*; use std::fs::File; fn main() -> io::Result<()> { block_on(async { let file = Unblock::new(File::open("a.txt")?); let reader = io::BufReader::new(file); let mut lines = reader.lines(); while let Some(line) = lines.next().await { println!("{}", line?); } Ok(()) }) }
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
Traits
AsyncBufReadExt | Extension trait for |
AsyncReadExt | Extension trait for |
AsyncSeekExt | Extension trait for |
AsyncWriteExt | Extension trait for |
Functions
copy | Copies the entire contents of a reader into a writer. |
empty | Creates an empty reader. |
repeat | Creates an infinite reader that reads the same byte repeatedly. |
sink | Creates a writer that consumes and drops all data. |