async-lazy
An async
version of once_cell::sync::Lazy
, std::sync::OnceLock
or lazy_static
. Uses tokio
's sychronization primitives.
This crate offers an API similar to the Lazy
type from async-once-cell
crate. The difference is that this crate's Lazy
accepts an FnOnce() -> impl Future
instead of a Future
, which makes use in statics easier.
Crate features
nightly
: Uses nightly Rust features to implementIntoFuture
for references toLazy
s, obviating the need to callforce()
.
Example
use Duration;
use Lazy;
async
static LAZY: = new;
async