Asynchronize blocking operation.
```rust use asynchron::{Futurize, Futurized, ITaskHandle, Progress}; use std::{ convert::Infallible, time::{Duration, Instant}, };
fn main() {
let instant: Instant = Instant::now();
let task: Futurized
// Try do the task now.
task.try_do();
loop {
if task.is_in_progress() {
match task.try_get() {
Progress::Current(task_receiver) => {
if let Some(value) = task_receiver {
println!("{}\n", value)
}
// Cancel if need to.
// task.cancel()
}
Progress::Canceled => {
println!("The task was canceled\n")
}
Progress::Completed(elapsed) => {
println!("The task finished in: {:?} milliseconds\n", elapsed)
}
Progress::Error(e) => {
println!("{}\n", e)
}
}
if task.is_done() {
break;
}
}
}
} ```
Mixing sync and async with tokio, reqwest and fltk-rs can be found here.