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

#290 in Concurrency

Download history 28099/week @ 2024-11-17 21145/week @ 2024-11-24 25774/week @ 2024-12-01 23690/week @ 2024-12-08 20870/week @ 2024-12-15 8928/week @ 2024-12-22 12262/week @ 2024-12-29 19482/week @ 2025-01-05 22297/week @ 2025-01-12 20041/week @ 2025-01-19 19553/week @ 2025-01-26 25756/week @ 2025-02-02 28011/week @ 2025-02-09 24907/week @ 2025-02-16 31926/week @ 2025-02-23 25472/week @ 2025-03-02

111,846 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