aboutsummaryrefslogtreecommitdiff
path: root/src/table/crdt/map.rs
diff options
context:
space:
mode:
authorTrinity Pointard <trinity.pointard@gmail.com>2021-04-23 21:42:52 +0200
committerAlex Auvolat <alex@adnab.me>2021-05-03 22:11:41 +0200
commitf5a0cf0414fc3db7affcbe7ffcf4e251a2afd192 (patch)
tree12c225c9456f18d96cf8a587ce9a308f433da9e7 /src/table/crdt/map.rs
parentf05bb111c2e7dd77f2b34b82892bbfa8e6a063c1 (diff)
downloadgarage-f5a0cf0414fc3db7affcbe7ffcf4e251a2afd192.tar.gz
garage-f5a0cf0414fc3db7affcbe7ffcf4e251a2afd192.zip
fix clippy warnings on table
Diffstat (limited to 'src/table/crdt/map.rs')
-rw-r--r--src/table/crdt/map.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/table/crdt/map.rs b/src/table/crdt/map.rs
index c4a30a26..c4dd1613 100644
--- a/src/table/crdt/map.rs
+++ b/src/table/crdt/map.rs
@@ -62,6 +62,11 @@ where
pub fn len(&self) -> usize {
self.vals.len()
}
+
+ /// Returns true if the map is empty
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
}
impl<K, V> CRDT for Map<K, V>
@@ -82,3 +87,13 @@ where
}
}
}
+
+impl<K, V> Default for Map<K, V>
+where
+ K: Clone + Ord,
+ V: Clone + CRDT,
+{
+ fn default() -> Self {
+ Self::new()
+ }
+}