Crates.io | asyncra |
lib.rs | asyncra |
version | |
source | src |
created_at | 2024-11-23 18:39:34.406223 |
updated_at | 2024-11-27 19:01:18.591987 |
description | Unblocking async runtime |
homepage | |
repository | |
max_upload_size | |
id | 1458637 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Full unblocking async runtime
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(())
}
cargo add asyncra