mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-10 09:01:34 +11:00
Implement Eq and PartialEq
This commit is contained in:
parent
5decb42cf0
commit
e9f6120b4c
|
@ -787,6 +787,28 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<K, V, ALLOCATOR: ClonableAllocator> PartialEq for HashMap<K, V, ALLOCATOR>
|
||||||
|
where
|
||||||
|
K: Eq + Hash,
|
||||||
|
V: PartialEq,
|
||||||
|
{
|
||||||
|
fn eq(&self, other: &HashMap<K, V, ALLOCATOR>) -> bool {
|
||||||
|
if self.len() != other.len() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.iter()
|
||||||
|
.all(|(key, value)| other.get(key).map_or(false, |v| *value == *v))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<K, V, ALLOCATOR: ClonableAllocator> Eq for HashMap<K, V, ALLOCATOR>
|
||||||
|
where
|
||||||
|
K: Eq + Hash,
|
||||||
|
V: PartialEq,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
const fn number_before_resize(capacity: usize) -> usize {
|
const fn number_before_resize(capacity: usize) -> usize {
|
||||||
capacity * 85 / 100
|
capacity * 85 / 100
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue