#async #lazy-static

async_once

async once tool for lazy_static

3 unstable releases

0.2.1 Oct 22, 2020
0.2.0 Oct 22, 2020
0.1.0 Jul 16, 2020

#2 in #lazy-static

Download history 371/week @ 2020-11-02 199/week @ 2020-11-09 427/week @ 2020-11-16 357/week @ 2020-11-23 190/week @ 2020-11-30 307/week @ 2020-12-07 392/week @ 2020-12-14 137/week @ 2020-12-21 25/week @ 2020-12-28 87/week @ 2021-01-04 405/week @ 2021-01-11 537/week @ 2021-01-18 665/week @ 2021-01-25 1252/week @ 2021-02-01 527/week @ 2021-02-08 622/week @ 2021-02-15

1,097 downloads per month

MIT/Apache

7KB
122 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