init
Some checks failed
CI / ci (push) Failing after 1m48s

This commit is contained in:
2026-08-25 23:24:36 +02:00
commit 95739892de
466 changed files with 33918 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
macro_rules! uuid_id {
($name:ident) => {
#[derive(
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
serde::Serialize, serde::Deserialize,
)]
pub struct $name(uuid::Uuid);
impl $name {
pub fn generate() -> Self {
Self(uuid::Uuid::new_v4())
}
pub fn from_uuid(uuid: uuid::Uuid) -> Self {
Self(uuid)
}
pub fn value(&self) -> uuid::Uuid {
self.0
}
}
impl Default for $name {
fn default() -> Self {
Self::generate()
}
}
impl From<uuid::Uuid> for $name {
fn from(uuid: uuid::Uuid) -> Self {
Self(uuid)
}
}
impl std::fmt::Display for $name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
};
}
pub(crate) use uuid_id;