#async #lazy-static

async_once

async once tool for lazy_static

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

#48 in Concurrency

Download history 57985/week @ 2023-06-08 36253/week @ 2023-06-15 72973/week @ 2023-06-22 45946/week @ 2023-06-29 40427/week @ 2023-07-06 41042/week @ 2023-07-13 48792/week @ 2023-07-20 54233/week @ 2023-07-27 52564/week @ 2023-08-03 64991/week @ 2023-08-10 52533/week @ 2023-08-17 45967/week @ 2023-08-24 23660/week @ 2023-08-31 32125/week @ 2023-09-07 32903/week @ 2023-09-14 30068/week @ 2023-09-21

128,441 downloads per month
Used in 15 crates (14 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