Crates.io | async_once |
lib.rs | async_once |
version | 0.2.6 |
source | src |
created_at | 2020-07-16 06:54:38.828879 |
updated_at | 2021-12-24 02:35:57.657285 |
description | async once tool for lazy_static |
homepage | https://github.com/hjiayz/async_once |
repository | https://github.com/hjiayz/async_once |
max_upload_size | |
id | 265678 |
size | 15,369 |
use lazy_static::lazy_static;
use tokio::runtime::Builder;
use async_once::AsyncOnce;
lazy_static!{
static ref FOO : AsyncOnce<u32> = AsyncOnce::new(async{
1
});
}
let rt = Builder::new_current_thread().build().unwrap();
rt.block_on(async {
assert_eq!(FOO.get().await , &1)
})
cargo test
wasm-pack test --headless --chrome --firefox
License: MIT OR Apache-2.0