mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-13 06:29:25 +00:00
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.
This commit is contained in:
16
patches/lazy_static/Cargo.toml
Normal file
16
patches/lazy_static/Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "lazy_static"
|
||||
version = "1.99.0"
|
||||
description = "`lazy_static` which patches to `std::sync::LazyLock`"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/patches/lazy_static"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
keywords = []
|
||||
edition = "2021"
|
||||
rust-version = "1.80"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[workspace]
|
||||
14
patches/lazy_static/src/lib.rs
Normal file
14
patches/lazy_static/src/lib.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
#[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);
|
||||
}
|
||||
Reference in New Issue
Block a user