use std::fmt;
macro_rules! integer_id {
($(#[$meta:meta])* $name:ident) => {
$(#[$meta])*
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct $name(u64);
impl $name {
pub const ZERO: Self = Self(0);
pub const fn new(value: u64) -> Self {
Self(value)
}
pub const fn get(self) -> u64 {
self.0
}
}
impl fmt::Display for $name {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(formatter)
}
}
};
}
integer_id!(
TenantId
);
integer_id!(
ShardId
);
integer_id!(
ShardEpoch
);
integer_id!(
PageId
);
integer_id!(
Lsn
);
integer_id!(
TxnId
);
integer_id!(
Revision
);