io: add missing utility functions (#1632)

The standard library's `io` module has small utilities such as `repeat`,
`empty`, and `sink`, which return `Read` and `Write` implementations.
These can come in handy in some circiumstances. `tokio::io` has no
equivalents that implement `AsyncRead`/`AsyncWrite`.

This commit adds `repeat`, `empty`, and `sink` helpers to `tokio::io`.
This commit is contained in:
Eliza Weisman
2019-10-07 14:02:04 -07:00
committed by Carl Lerche
parent ab2f71a612
commit 8aa520e2bd
7 changed files with 281 additions and 4 deletions
+2 -2
View File
@@ -41,8 +41,8 @@
pub use tokio_fs::{stderr, stdin, stdout, Stderr, Stdin, Stdout};
pub use tokio_io::split::split;
pub use tokio_io::{
AsyncBufRead, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, BufReader,
BufWriter,
empty, repeat, sink, AsyncBufRead, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncWrite,
AsyncWriteExt, BufReader, BufWriter, Empty, Repeat, Sink,
};
// Re-export io::Error so that users don't have to deal