2 releases
0.3.1 | Mar 28, 2023 |
---|---|
0.3.0 | Mar 28, 2023 |
0.2.0 |
|
0.1.0 |
|
#1295 in Asynchronous
9,984 downloads per month
Used in tokio-utils
5KB
Async-Stdin
Read from stdin over a Tokio channel
This is useful for interactive programs that read from stdin while waiting for other events to occur.
Usage
Add this to your Cargo.toml:
[dependencies]
async-stdin = "0.3.1"
You can read from stdin like so:
use async_stdin::recv_from_stdin;
#[tokio::main]
async fn main() {
let mut rx = recv_from_stdin(10);
while let Some(s) = rx.recv().await {
println!("Received: {}", s);
}
}
Dependencies
~2–3MB
~46K SLoC