Last chapter on async Rust

This commit is contained in:
LukeMathWalker
2024-05-15 20:00:48 +02:00
parent 6e581440bf
commit aa58dcb5ca
33 changed files with 1799 additions and 10 deletions

View File

@@ -0,0 +1,15 @@
//! TODO: get the code to compile by **re-ordering** the statements
//! in the `example` function. You're not allowed to change the
//! `spawner` function nor what each line does in `example`.
use std::rc::Rc;
use tokio::task::yield_now;
fn spawner() {
tokio::spawn(example());
}
async fn example() {
let non_send = Rc::new(1);
yield_now().await;
println!("{}", non_send);
}