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

#131 in Concurrency

Download history 30733/week @ 2024-09-25 33099/week @ 2024-10-02 32213/week @ 2024-10-09 30063/week @ 2024-10-16 33398/week @ 2024-10-23 25391/week @ 2024-10-30 21986/week @ 2024-11-06 23999/week @ 2024-11-13 28578/week @ 2024-11-20 20509/week @ 2024-11-27 25888/week @ 2024-12-04 23219/week @ 2024-12-11 16002/week @ 2024-12-18 8948/week @ 2024-12-25 15886/week @ 2025-01-01 16228/week @ 2025-01-08

61,603 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