Skip to main content

Async

Use the async keyword with a function call to execute the function call in parallel. You can call every function with async. async returns a std::sync::Channel that you can use to wait for the result

src/structs.duck
fn give_me_int_after_3_s() -> Int {
std::task::sleep(std::time::Duration::seconds(3));
10
}

fn main() {
std::io::println((async give_me_int_after_3_s()).recv_block().to_string());
}