1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
pub type RevisionValue = u64; #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] pub struct Revision(RevisionValue); impl Revision { pub const fn initial() -> Self { Self(0) } pub fn is_initial(self) -> bool { self == Self::initial() } pub fn next(self) -> Self { Self(self.0.saturating_add(1)) } } impl From<Revision> for RevisionValue { fn from(from: Revision) -> Self { from.0 } } impl From<RevisionValue> for Revision { fn from(from: RevisionValue) -> Self { Self(from) } }