8 releases

0.2.6 Dec 24, 2021
0.2.5 Dec 23, 2021
0.2.1 Oct 22, 2020
0.1.0 Jul 16, 2020

#94 in Concurrency

Download history 34114/week @ 2024-07-19 31693/week @ 2024-07-26 24815/week @ 2024-08-02 28155/week @ 2024-08-09 28726/week @ 2024-08-16 31376/week @ 2024-08-23 24038/week @ 2024-08-30 31236/week @ 2024-09-06 32641/week @ 2024-09-13 30415/week @ 2024-09-20 31796/week @ 2024-09-27 32856/week @ 2024-10-04 30478/week @ 2024-10-11 32138/week @ 2024-10-18 31703/week @ 2024-10-25 23145/week @ 2024-11-01

124,471 downloads per month
Used in 19 crates (18 directly)

MIT/Apache

10KB
176 lines

async_once

async once tool for lazy_static

Examples

   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)
   })

run tests

   cargo test
   wasm-pack test --headless --chrome --firefox

License: MIT OR Apache-2.0


lib.rs:

async once tool for lazy_static

Examples

   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)
   })

run tests

   cargo test
   wasm-pack test --headless --chrome --firefox

No runtime deps