2个版本
0.3.1 | 2023年3月28日 |
---|---|
0.3.0 | 2023年3月28日 |
0.2.0 |
|
0.1.0 |
|
#1295 in 异步
9,984 每月下载量
在 tokio-utils 中使用
5KB
Async-Stdin
通过Tokio通道从stdin读取
这对于交互式程序很有用,这些程序在等待其他事件发生时从stdin读取。
用法
将此添加到您的Cargo.toml中
[dependencies]
async-stdin = "0.3.1"
您可以这样从stdin读取
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);
}
}
依赖项
~2–3MB
~46K SLoC