MicroAsync
(GitHub) does not have many features, no IO
support, no proper runtime. MicroAsync-Runtime provides such things:
- A small runtime with the ability to add tasks (no_std
supported)
- A small timer
- AsyncIO for Files, TCP, and UDP
QueuedRuntime is a very small async runtime with support for adding more tasks while it is running. New tasks MUST only be added from within tasks already running on it OR before it is awaited!
```rs use microasync::sync; use microasyncrt::{QueuedRuntime, waitms};
fn main() { let mut runtime = QueuedRuntime::new(); for _ in 0..50 { runtime.push(printsomethingafter_ms(2000)); } sync(runtime); }
async fn printsomethingafterms(ms: u64) { waitms(ms).await; println!("something! :D"); } ```
```rs use microasync::sync; use microasyncrt::{QueuedRuntime, waitms, getcurrentruntime};
fn main() { sync(QueuedRuntime::newwith(printsomethingafterms(0))); }
async fn printsomethingafterms(ms: u64) { waitms(ms).await; println!("something after {ms}ms! :D"); getcurrentruntime().await.push(printsomethingafter_ms(ms + 1)); } ```
There are a bunch of examples in examples/ - feel free to check those out!
MicroAsync-Runtime is compatible with async-core.