mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-07 07:38:59 +00:00
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
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
description = "proxmox api schema and validation"
|
description = "proxmox api schema and validation"
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
exclude.workspace = true
|
exclude.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
const_format = { workspace = true, optional = true }
|
const_format = { workspace = true, optional = true }
|
||||||
lazy_static.workspace = true
|
|
||||||
regex.workspace = true
|
regex.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
@ -5,7 +5,7 @@ use std::fmt;
|
|||||||
/// The current Regex::new() function is not `const_fn`. Unless that
|
/// The current Regex::new() function is not `const_fn`. Unless that
|
||||||
/// works, we use `ConstRegexPattern` to represent static regular
|
/// works, we use `ConstRegexPattern` to represent static regular
|
||||||
/// expressions. Please use the `const_regex` macro to generate
|
/// expressions. Please use the `const_regex` macro to generate
|
||||||
/// instances of this type (uses lazy_static).
|
/// instances of this type.
|
||||||
pub struct ConstRegexPattern {
|
pub struct ConstRegexPattern {
|
||||||
/// This is only used for documentation and debugging
|
/// This is only used for documentation and debugging
|
||||||
pub regex_string: &'static str,
|
pub regex_string: &'static str,
|
||||||
@ -47,9 +47,7 @@ macro_rules! const_regex {
|
|||||||
$crate::ConstRegexPattern {
|
$crate::ConstRegexPattern {
|
||||||
regex_string: $regex,
|
regex_string: $regex,
|
||||||
regex_obj: (|| -> &'static ::regex::Regex {
|
regex_obj: (|| -> &'static ::regex::Regex {
|
||||||
$crate::semver_exempt::lazy_static! {
|
static SCHEMA: std::sync::LazyLock<::regex::Regex> = std::sync::LazyLock::new(|| ::regex::Regex::new($regex).unwrap());
|
||||||
static ref SCHEMA: ::regex::Regex = ::regex::Regex::new($regex).unwrap();
|
|
||||||
}
|
|
||||||
&SCHEMA
|
&SCHEMA
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
@ -29,13 +29,5 @@ pub use schema::*;
|
|||||||
|
|
||||||
pub mod upid;
|
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")]
|
#[cfg(feature = "api-types")]
|
||||||
pub mod api_types;
|
pub mod api_types;
|
||||||
|
Loading…
Reference in New Issue
Block a user