diff --git a/agb-hashmap/src/lib.rs b/agb-hashmap/src/lib.rs index e99f6194..73c5bf31 100644 --- a/agb-hashmap/src/lib.rs +++ b/agb-hashmap/src/lib.rs @@ -787,6 +787,28 @@ where } } +impl PartialEq for HashMap +where + K: Eq + Hash, + V: PartialEq, +{ + fn eq(&self, other: &HashMap) -> bool { + if self.len() != other.len() { + return false; + } + + self.iter() + .all(|(key, value)| other.get(key).map_or(false, |v| *value == *v)) + } +} + +impl Eq for HashMap +where + K: Eq + Hash, + V: PartialEq, +{ +} + const fn number_before_resize(capacity: usize) -> usize { capacity * 85 / 100 }