use std::time::Duration;
pub trait PartialOrder: Eq {
#[inline]
fn less_than(&self, other: &Self) -> bool {
self != other && self.less_equal(other)
}
fn less_equal(&self, other: &Self) -> bool;
}
pub trait TotalOrder: PartialOrder {}
macro_rules! impl_order {
($($type:ty),* $(,)?) => (
$(
impl PartialOrder for $type {
#[inline]
fn less_than(&self, other: &Self) -> bool {
self < other
}
#[inline]
fn less_equal(&self, other: &Self) -> bool {
self <= other
}
}
impl TotalOrder for $type {}
)*
)
}
impl_order! {
u8,
u16,
u32,
u64,
u128,
usize,
i8,
i16,
i32,
i64,
i128,
isize,
(),
Duration,
}