小编ele*_*von的帖子

不阻塞地读取 Childstdout

我正在尝试重现 Shepmasters 对这个问题的回答,但出现以下编译错误。

error[E0599]: the method `for_each` exists for struct `tokio::io::Lines<tokio::io::BufReader<tokio::process::ChildStdout>>`, but its trait bounds were not satisfied
  --> src/main.rs:19:10
   |
19 |           .for_each(|s| async move { println!("> {:?}", s) })
   |            ^^^^^^^^ method cannot be called on `tokio::io::Lines<tokio::io::BufReader<tokio::process::ChildStdout>>` due to unsatisfied trait bounds
   | 
  ::: /home/.../tokio-1.7.1/src/io/util/lines.rs:10:1
   |
10 | / pin_project! {
11 | |     /// Read lines from an [`AsyncBufRead`].
12 | |     ///
13 | |     /// A `Lines` can be turned into a `Stream` …
Run Code Online (Sandbox Code Playgroud)

rust rust-tokio

4
推荐指数
1
解决办法
2024
查看次数

标签 统计

rust ×1

rust-tokio ×1