Expand description
§Asyncified
This small, zero-dependency library provides a wrapper to hide synchronous, blocking types behind an async interface that is runtime agnostic.
§Example
use asyncified::Asyncified;
// Construct a thing (that could take time) inside
// the Asyncified container, awaiting it to be ready.
// prefer `new()` if you want to be able to return an error.
let s = Asyncified::builder().build_ok(SlowThing::new).await;
// Perform some potentially slow operation on the thing
// inside the container, awaiting the result.
let n = s.call(|slow_thing| {
std::thread::sleep(std::time::Duration::from_secs(1));
123usize
}).await;
Structs§
- Asyncified
- The whole point.
- Asyncified
Builder