[Add] Structure

This commit is contained in:
Alex Emmet 2026-07-20 22:21:43 +02:00
commit ed1b21b3ff
44 changed files with 2210 additions and 2721 deletions

30
src/models/ids.rs Normal file
View file

@ -0,0 +1,30 @@
use std::fmt::{Display, Formatter};
macro_rules! id_type {
($name:ident) => {
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, serde::Serialize)]
pub struct $name(pub i64);
impl From<i64> for $name {
fn from(value: i64) -> Self {
Self(value)
}
}
impl From<$name> for i64 {
fn from(value: $name) -> Self {
value.0
}
}
impl Display for $name {
fn fmt(&self, formatter: &mut Formatter<'_>) -> std::fmt::Result {
self.0.fmt(formatter)
}
}
};
}
id_type!(UserId);
id_type!(IotaId);
id_type!(OmikronId);