async-stdin

Crates.ioasync-stdin
lib.rsasync-stdin
version0.3.1
sourcesrc
created_at2020-06-07 08:16:08.941699
updated_at2023-03-28 03:24:18.929494
descriptionAsynchronously read from stdin
homepage
repository
max_upload_size
id250897
size14,776
Will Cygan (wcygan)

documentation

README

Async-Stdin

github crates.io docs.rs build status

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);
    }
}
Commit count: 0

cargo fmt