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

#77 in Concurrency

Download history 42660/week @ 2024-02-26 42519/week @ 2024-03-04 43398/week @ 2024-03-11 40914/week @ 2024-03-18 40054/week @ 2024-03-25 32357/week @ 2024-04-01 35872/week @ 2024-04-08 39395/week @ 2024-04-15 38508/week @ 2024-04-22 34224/week @ 2024-04-29 40651/week @ 2024-05-06 40596/week @ 2024-05-13 35930/week @ 2024-05-20 32358/week @ 2024-05-27 43356/week @ 2024-06-03 35390/week @ 2024-06-10

147,923 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