Start,
Ready,
}
impl Future for DoHeavyWork {
fn poll(..) -> Poll<()> {
loop {
match self {
Self::Start => {
println!("start heavy task");
for _ in 0..800000000 {}
println!("heavy task done");
return Poll::Ready(());
}
Self::Ready => panic!("called async fn after return"),
}
}
}
}
each variant in the enum is an .await point. see?
No i don't understand what you want me to show with this example
Обсуждают сегодня