Files
serai/patches/lazy_static/src/lib.rs
Luke Parker ee9b9778b5 Patch lazy_static to std::sync::LazyLock
This does remove the no-`std` variant of `lazy_static`, but that was unused and
`std` was not additively implemented (making it poor to work with).

This primarily tidies our `deny.toml` with one less `git` dependency.
2025-12-11 03:50:29 -05:00

15 lines
442 B
Rust

#[macro_export]
macro_rules! lazy_static {
($($(#[$attr: meta])* $vis: vis static ref $name: ident: $type: ty = $value: expr;)*) => {
$(
$(#[$attr])*
$vis static $name: std::sync::LazyLock<$type> = std::sync::LazyLock::new(|| $value);
)*
}
}
/// Explicitly initialize a static declared with [`lazy_static`].
pub fn initialize<T, F: Fn() -> T>(lazy: &std::sync::LazyLock<T, F>) {
std::sync::LazyLock::force(lazy);
}