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

#50 in Concurrency

Download history 14036/week @ 2023-12-23 26694/week @ 2023-12-30 38779/week @ 2024-01-06 37950/week @ 2024-01-13 41658/week @ 2024-01-20 39107/week @ 2024-01-27 37774/week @ 2024-02-03 39876/week @ 2024-02-10 34241/week @ 2024-02-17 41105/week @ 2024-02-24 43853/week @ 2024-03-02 41295/week @ 2024-03-09 43782/week @ 2024-03-16 40034/week @ 2024-03-23 33115/week @ 2024-03-30 27713/week @ 2024-04-06

151,996 downloads per month
Used in 18 crates (17 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