pub trait PartialOrder : Eq {
fn less_than(&self, other: &Self) -> bool {
self.less_equal(other) && self != other
}
fn less_equal(&self, other: &Self) -> bool;
}
pub trait TotalOrder : PartialOrder { }
macro_rules! implement_partial {
($($index_type:ty,)*) => (
$(
impl PartialOrder for $index_type {
#[inline(always)] fn less_than(&self, other: &Self) -> bool { self < other }
#[inline(always)] fn less_equal(&self, other: &Self) -> bool { self <= other }
}
)*
)
}
macro_rules! implement_total {
($($index_type:ty,)*) => (
$(
impl TotalOrder for $index_type { }
)*
)
}
implement_partial!(u8, u16, u32, u64, usize, i8, i16, i32, i64, isize, (),);
implement_total!(u8, u16, u32, u64, usize, i8, i16, i32, i64, isize, (),);