#run-time #async #node #unblocking

bin+lib asyncra

Unblocking async runtime

3 unstable releases

0.1.0 Nov 27, 2024
0.1.0-beta Nov 24, 2024
0.0.0 Nov 23, 2024

#135 in #node

Download history 199/week @ 2024-11-20 177/week @ 2024-11-27

376 downloads per month

Apache-2.0

15KB
223 lines

Crates.io Version Crates.io Total Downloads

Here is Asyncra

Full unblocking async runtime

Example

use asyncra::SharedValue;

#[asyncra::main]
async fn main() -> asyncra::Result<()> {
    let num = SharedValue::new(12);
    let num_c = num.clone();
    asyncra::spawn_node( async move {
        for _ in 0..10 {
            let num_3 = num_c.read::<i32>().await;
            println!("Num now is: {num_3}");
        }
        Ok(())
    });
    asyncra::spawn_node(async move {
        for _ in 0..10 {
            let num_ = num.read::<i32>().await;
            num.write(num_ + 1);
        }
        Ok(())
    });
    Ok(())
}

Installation

cargo add asyncra

TODO

  1. Add task and thread spawner
  2. Add join macros for launch parallel threads at the same time

License

Dependencies

~11–23MB
~327K SLoC