Minimal and simpler alternative to the futures crate.
forbid(unsafe_code)
)This example goes in a loop and prints "One" every second, and "Two" every other second. After 10 prints, the program terminates.
```rust
async fn timerfuture(duration: std::time::Duration) { pasts::spawnblocking(move || std::thread::sleep(duration)).await }
async fn one(context: &mut usize) { timer_future(std::time::Duration::new(1, 0)).await; println!("One {}", *context); *context += 1; }
async fn two(context: &mut usize) { timer_future(std::time::Duration::new(2, 0)).await; println!("Two {}", *context); *context += 1; }
async fn example() { let mut context: usize = 0;
pasts::run!(context while context < 10; one, two)
}
fn main() {