All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #206
25 lines
617 B
Rust
25 lines
617 B
Rust
#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, Debug, Eq, PartialEq, Hash)]
|
|
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;
|