use std::fmt;
use std::marker::PhantomData;
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
pub struct Id<T> {
value: u64,
_marker: PhantomData<fn() -> T>,
}
impl<T> Id<T> {
pub const fn new(value: u64) -> Self {
Self {
value,
_marker: PhantomData,
}
}
pub const fn get(self) -> u64 {
self.value
}
}
impl<T> fmt::Display for Id<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.value.fmt(f)
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
pub struct ObjectIdMarker;
pub type ObjectId = Id<ObjectIdMarker>;