async
non-move
closures with parameters are currently not supported.
Erroneous code example:
#![feature(async_closure)]
fn main() {
let add_one = async |num: u8| { // error!
num + 1
};
}
Runasync
with non-move is currently not supported with the current
version, you can use successfully by using move:
#![feature(async_closure)]
fn main() {
let add_one = async move |num: u8| { // ok!
num + 1
};
}
Run