vecdb/
stamp.rs

1use allocative::Allocative;
2use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout};
3
4/// Marker for tracking when data was last modified.
5///
6/// Used for change tracking, rollback support, and ETag generation.
7#[derive(
8    Debug,
9    Default,
10    Clone,
11    Copy,
12    PartialEq,
13    Eq,
14    PartialOrd,
15    Ord,
16    FromBytes,
17    IntoBytes,
18    Immutable,
19    KnownLayout,
20    Allocative,
21)]
22pub struct Stamp(u64);
23
24impl Stamp {
25    pub fn new(stamp: u64) -> Self {
26        Self(stamp)
27    }
28}
29
30impl From<u64> for Stamp {
31    fn from(value: u64) -> Self {
32        Self(value)
33    }
34}
35
36impl From<Stamp> for u64 {
37    fn from(value: Stamp) -> Self {
38        value.0
39    }
40}