Refacto structures definition

This commit is contained in:
2023-12-28 19:29:26 +01:00
parent f7777fe085
commit 9d4f19822d
20 changed files with 1860 additions and 1839 deletions

View File

@ -0,0 +1,24 @@
#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, Debug)]
pub struct XMLUuid(pub uuid::Uuid);
impl XMLUuid {
pub fn parse_from_str(s: &str) -> anyhow::Result<Self> {
Ok(Self(uuid::Uuid::parse_str(s)?))
}
pub fn new_random() -> Self {
Self(uuid::Uuid::new_v4())
}
pub fn as_string(&self) -> String {
self.0.to_string()
}
pub fn is_valid(&self) -> bool {
log::debug!("UUID version ({}): {}", self.0, self.0.get_version_num());
self.0.get_version_num() == 4
}
}
pub mod domain;
pub mod network;
pub mod nwfilter;