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§
- Assert
Async - Asserts that a type implementing
std::iotraits can be used as an async type. - Async
AsSync - A wrapper around a type that implements
AsyncReadorAsyncWritethat convertsPendingpolls toWouldBlockerrors. - BlockOn
- Blocks on all async I/O operations and implements
std::iotraits. - BufReader
- Adds buffering to a reader.
- BufWriter
- Adds buffering to a writer.
- Bytes
- Reader for the
AsyncReadExt::bytes()method. - Chain
- Reader for the
AsyncReadExt::chain()method. - Close
Future - Future for the
AsyncWriteExt::close()method. - Cursor
- Gives an in-memory buffer a cursor for reading and writing.
- Empty
- Reader for the
empty()function. - FillBuf
- Future for the
AsyncBufReadExt::fill_buf()method. - Flush
Future - Future for the
AsyncWriteExt::flush()method. - Lines
- Stream for the
AsyncBufReadExt::lines()method. - Read
Exact Future - Future for the
AsyncReadExt::read_exact()method. - Read
Future - Future for the
AsyncReadExt::read()method. - Read
Half - The read half returned by
split(). - Read
Line Future - Future for the
AsyncBufReadExt::read_line()method. - Read
ToEnd Future - Future for the
AsyncReadExt::read_to_end()method. - Read
ToString Future - Future for the
AsyncReadExt::read_to_string()method. - Read
Until Future - Future for the
AsyncBufReadExt::read_until()method. - Read
Vectored Future - Future for the
AsyncReadExt::read_vectored()method. - Repeat
- Reader for the
repeat()function. - Seek
Future - Future for the
AsyncSeekExt::seek()method. - Sink
- Writer for the
sink()function. - Split
- Stream for the
AsyncBufReadExt::split()method. - Take
- Reader for the
AsyncReadExt::take()method. - Write
AllFuture - Future for the
AsyncWriteExt::write_all()method. - Write
Future - Future for the
AsyncWriteExt::write()method. - Write
Half - The write half returned by
split(). - Write
Vectored Future - Future for the
AsyncWriteExt::write_vectored()method.
Traits§
- Async
BufRead Ext - Extension trait for
AsyncBufRead. - Async
Read Ext - Extension trait for
AsyncRead. - Async
Seek Ext - Extension trait for
AsyncSeek. - Async
Write Ext - Extension trait for
AsyncWrite.
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.
- split
- Splits a stream into
AsyncReadandAsyncWritehalves.
Type Aliases§
- Boxed
Reader - Type alias for
Pin<Box<dyn AsyncRead + Send + 'static>>. - Boxed
Writer - Type alias for
Pin<Box<dyn AsyncWrite + Send + 'static>>.