use core::cmp::{Ord, PartialOrd};
pub(super) type Score = i64;
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub struct FzfDistance(Score);
impl PartialOrd for FzfDistance {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for FzfDistance {
#[inline]
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
other.0.cmp(&self.0)
}
}
impl Default for FzfDistance {
#[inline]
fn default() -> Self {
Self::from_score(0)
}
}
impl FzfDistance {
#[inline(always)]
pub(super) fn from_score(score: Score) -> Self {
Self(score)
}
#[cfg(any(feature = "__into-score", feature = "__tests"))]
#[inline(always)]
pub fn into_score(self) -> Score {
self.0
}
}