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

#74 in Concurrency

Download history 45321/week @ 2024-03-14 40118/week @ 2024-03-21 36342/week @ 2024-03-28 31500/week @ 2024-04-04 40089/week @ 2024-04-11 36516/week @ 2024-04-18 37076/week @ 2024-04-25 35329/week @ 2024-05-02 42892/week @ 2024-05-09 39329/week @ 2024-05-16 30969/week @ 2024-05-23 40453/week @ 2024-05-30 40915/week @ 2024-06-06 37213/week @ 2024-06-13 37521/week @ 2024-06-20 25865/week @ 2024-06-27

151,010 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