diff --git a/patch-db/src/model.rs b/patch-db/src/model.rs index 1cc71de..bb304ce 100644 --- a/patch-db/src/model.rs +++ b/patch-db/src/model.rs @@ -231,15 +231,22 @@ impl Deserialize<'de>> HasModel for Vec { pub trait Map { type Key: AsRef; type Value; + fn get(&self, key: &Self::Key) -> Option<&Self::Value>; } -impl, V> Map for HashMap { +impl + Eq + Hash, V> Map for HashMap { type Key = K; type Value = V; + fn get(&self, key: &Self::Key) -> Option<&Self::Value> { + HashMap::get(self, key) + } } -impl, V> Map for BTreeMap { +impl + Ord, V> Map for BTreeMap { type Key = K; type Value = V; + fn get(&self, key: &Self::Key) -> Option<&Self::Value> { + self.get(key) + } } #[derive(Debug, Clone)]