diff options
Diffstat (limited to 'src/util/crdt/lww.rs')
-rw-r--r-- | src/util/crdt/lww.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/crdt/lww.rs b/src/util/crdt/lww.rs index 43d13f27..6990b865 100644 --- a/src/util/crdt/lww.rs +++ b/src/util/crdt/lww.rs @@ -77,11 +77,21 @@ where self.v = new_value; } + /// Get the timestamp currently associated with the value + pub fn timestamp(&self) -> u64 { + self.ts + } + /// Get the CRDT value pub fn get(&self) -> &T { &self.v } + /// Take the CRDT value + pub fn take(self) -> T { + self.v + } + /// Get a mutable reference to the CRDT's value /// /// This is usefull to mutate the inside value without changing the LWW timestamp. |