forked from Proxmox/proxmox
schema: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
9530b75286
commit
ab3f4a2fc4
@ -6,13 +6,13 @@ edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
description = "proxmox api schema and validation"
|
||||
rust-version.workspace = true
|
||||
|
||||
exclude.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
const_format = { workspace = true, optional = true }
|
||||
lazy_static.workspace = true
|
||||
regex.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
@ -5,7 +5,7 @@ use std::fmt;
|
||||
/// The current Regex::new() function is not `const_fn`. Unless that
|
||||
/// works, we use `ConstRegexPattern` to represent static regular
|
||||
/// expressions. Please use the `const_regex` macro to generate
|
||||
/// instances of this type (uses lazy_static).
|
||||
/// instances of this type.
|
||||
pub struct ConstRegexPattern {
|
||||
/// This is only used for documentation and debugging
|
||||
pub regex_string: &'static str,
|
||||
@ -47,9 +47,7 @@ macro_rules! const_regex {
|
||||
$crate::ConstRegexPattern {
|
||||
regex_string: $regex,
|
||||
regex_obj: (|| -> &'static ::regex::Regex {
|
||||
$crate::semver_exempt::lazy_static! {
|
||||
static ref SCHEMA: ::regex::Regex = ::regex::Regex::new($regex).unwrap();
|
||||
}
|
||||
static SCHEMA: std::sync::LazyLock<::regex::Regex> = std::sync::LazyLock::new(|| ::regex::Regex::new($regex).unwrap());
|
||||
&SCHEMA
|
||||
})
|
||||
};
|
||||
|
@ -29,13 +29,5 @@ pub use schema::*;
|
||||
|
||||
pub mod upid;
|
||||
|
||||
// const_regex uses lazy_static, but we otherwise don't need it, and don't want to force users to
|
||||
// have to write it out in their Cargo.toml as dependency, so we add a hidden re-export here which
|
||||
// is semver-exempt!
|
||||
#[doc(hidden)]
|
||||
pub mod semver_exempt {
|
||||
pub use lazy_static::lazy_static;
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-types")]
|
||||
pub mod api_types;
|
||||
|
Loading…
Reference in New Issue
Block a user