pub trait MaxMin: PartialOrd {
fn get_max(self, other: Self) -> Self;
fn get_min(self, other: Self) -> Self;
fn non_zero_positive_min_value() -> Self;
}
impl MaxMin for f32 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
Self::EPSILON
}
}
impl MaxMin for f64 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
Self::EPSILON
}
}
impl MaxMin for u8 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for u16 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for u32 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for u64 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for u128 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for usize {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for i8 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for i16 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for i32 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for i64 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}
impl MaxMin for i128 {
#[inline(always)]
fn get_max(self, other: Self) -> Self {
self.max(other)
}
#[inline(always)]
fn get_min(self, other: Self) -> Self {
self.min(other)
}
#[inline(always)]
fn non_zero_positive_min_value() -> Self {
1
}
}