collections: Implement Eq for DList, RingBuf, TreeMap, TreeSet
This commit is contained in:
parent
f2fa55903e
commit
25acfde398
3 changed files with 8 additions and 0 deletions
|
|
@ -683,6 +683,8 @@ impl<A: PartialEq> PartialEq for DList<A> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A: Eq> Eq for DList<A> {}
|
||||
|
||||
impl<A: PartialOrd> PartialOrd for DList<A> {
|
||||
fn partial_cmp(&self, other: &DList<A>) -> Option<Ordering> {
|
||||
iter::order::partial_cmp(self.iter(), other.iter())
|
||||
|
|
|
|||
|
|
@ -452,6 +452,8 @@ impl<A: PartialEq> PartialEq for RingBuf<A> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A: Eq> Eq for RingBuf<A> {}
|
||||
|
||||
impl<A: PartialOrd> PartialOrd for RingBuf<A> {
|
||||
fn partial_cmp(&self, other: &RingBuf<A>) -> Option<Ordering> {
|
||||
iter::order::partial_cmp(self.iter(), other.iter())
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ impl<K: PartialEq + Ord, V: PartialEq> PartialEq for TreeMap<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<K: Eq + Ord, V: Eq> Eq for TreeMap<K, V> {}
|
||||
|
||||
impl<K: Ord, V: PartialOrd> PartialOrd for TreeMap<K, V> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &TreeMap<K, V>) -> Option<Ordering> {
|
||||
|
|
@ -1010,6 +1012,8 @@ impl<T: PartialEq + Ord> PartialEq for TreeSet<T> {
|
|||
fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
|
||||
}
|
||||
|
||||
impl<T: Eq + Ord> Eq for TreeSet<T> {}
|
||||
|
||||
impl<T: Ord> PartialOrd for TreeSet<T> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &TreeSet<T>) -> Option<Ordering> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue