mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-10-03 07:14:45 +00:00
Implement PartialEq and Eq for IndexMap
This commit is contained in:
parent
9588c8554d
commit
7107014806
@ -781,6 +781,34 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<K, V, N, S, N2, S2> PartialEq<IndexMap<K, V, N2, S2>> for IndexMap<K, V, N, S>
|
||||||
|
where
|
||||||
|
K: Eq + Hash,
|
||||||
|
V: Eq,
|
||||||
|
S: BuildHasher,
|
||||||
|
N: ArrayLength<Bucket<K, V>> + ArrayLength<Option<Pos>>,
|
||||||
|
S2: BuildHasher,
|
||||||
|
N2: ArrayLength<Bucket<K, V>> + ArrayLength<Option<Pos>>,
|
||||||
|
{
|
||||||
|
fn eq(&self, other: &IndexMap<K, V, N2, S2>) -> bool {
|
||||||
|
return self.len() == other.len()
|
||||||
|
&& self
|
||||||
|
.iter()
|
||||||
|
.all(|(key, value)| other.get(key).map_or(false, |v| *value == *v))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<K, V, N, S> Eq for IndexMap<K, V, N, S>
|
||||||
|
where
|
||||||
|
K: Eq + Hash,
|
||||||
|
V: Eq,
|
||||||
|
S: BuildHasher,
|
||||||
|
N: ArrayLength<Bucket<K, V>> + ArrayLength<Option<Pos>>,
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<K, V, N, S> Extend<(K, V)> for IndexMap<K, V, N, S>
|
impl<K, V, N, S> Extend<(K, V)> for IndexMap<K, V, N, S>
|
||||||
where
|
where
|
||||||
K: Eq + Hash,
|
K: Eq + Hash,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user