Complete PartialOrd implementation

PartialOrd partialness requires all methods to be overridden to provide
consistent quirkyness with floats.
This commit is contained in:
bluss
2015-09-10 15:13:26 +02:00
parent 5b29055b5a
commit c3f2866bd3
+21
View File
@@ -644,9 +644,30 @@ impl<A: Array> Default for ArrayVec<A> {
} }
impl<A: Array> PartialOrd for ArrayVec<A> where A::Item: PartialOrd { impl<A: Array> PartialOrd for ArrayVec<A> where A::Item: PartialOrd {
#[inline]
fn partial_cmp(&self, other: &ArrayVec<A>) -> Option<cmp::Ordering> { fn partial_cmp(&self, other: &ArrayVec<A>) -> Option<cmp::Ordering> {
(**self).partial_cmp(other) (**self).partial_cmp(other)
} }
#[inline]
fn lt(&self, other: &Self) -> bool {
(**self).lt(other)
}
#[inline]
fn le(&self, other: &Self) -> bool {
(**self).le(other)
}
#[inline]
fn ge(&self, other: &Self) -> bool {
(**self).ge(other)
}
#[inline]
fn gt(&self, other: &Self) -> bool {
(**self).gt(other)
}
} }
impl<A: Array> Ord for ArrayVec<A> where A::Item: Ord { impl<A: Array> Ord for ArrayVec<A> where A::Item: Ord {