ofdb_entities/
revision.rs

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