I'm trying to use async/await with processes in Rust. I'm using tokio
and tokio-process
:
#![feature(await_macro, async_await, futures_api)]
extern crate tokio;
extern crate tokio_process;
use std::process::Command;
use tokio_process::CommandExt;
fn main() {
tokio::run_async(main_async());
}
async fn main_async() {
let out = Command::new("echo")
.arg("hello")
.arg("world")
.output_async();
let s = await!(out);
}
Here is the error that I get:
error[E0277]: the trait bound `tokio_process::OutputAsync: std::future::Future` is not satisfied
--> src/main.rs:21:13
|
21 | let s = await!(out);
| ^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `tokio_process::OutputAsync`
|
= note: required by `std::future::poll_with_tls_waker`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error[E0277]: the trait bound `tokio_process::OutputAsync: std::future::Future` is not satisfied
--> src/main.rs:21:13
|
21 | let s = await!(out);
| ^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `tokio_process::OutputAsync`
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
How do I get this right?