use std::cmp::Ordering;
#[repr(isize)] #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub enum CFComparisonResult {
LessThan = -1,
EqualTo = 0,
GreaterThan = 1,
}
impl From<Ordering> for CFComparisonResult {
#[inline]
fn from(ordering: Ordering) -> Self {
match ordering {
Ordering::Less => Self::LessThan,
Ordering::Equal => Self::EqualTo,
Ordering::Greater => Self::GreaterThan,
}
}
}
impl From<CFComparisonResult> for Ordering {
#[inline]
fn from(result: CFComparisonResult) -> Self {
match result {
CFComparisonResult::LessThan => Self::Less,
CFComparisonResult::EqualTo => Self::Equal,
CFComparisonResult::GreaterThan => Self::Greater,
}
}
}
impl CFComparisonResult {
#[inline]
pub fn into_ordering(self) -> Ordering {
self.into()
}
}