mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 23:42:27 +00:00
22 lines
640 B
Rust
22 lines
640 B
Rust
//! Typed ids. All ids come from one session-wide counter so they never collide across kinds.
|
|
|
|
macro_rules! id_type {
|
|
($name:ident) => {
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default, serde::Serialize, serde::Deserialize)]
|
|
#[serde(transparent)]
|
|
pub struct $name(pub u64);
|
|
impl std::fmt::Display for $name {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "{}", self.0)
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
id_type!(TrackId);
|
|
id_type!(ClipId);
|
|
id_type!(SourceId);
|
|
id_type!(BusId);
|
|
id_type!(GroupId);
|
|
id_type!(MarkerId);
|