Files
face-detector/bbox/src/traits/min.rs
uttarayan21 4b4d23d1d4 feat(bbox): add bounding box implementation with serialization
Add initial implementation of the `BBox` struct in the `bbox` module,
including basic operations and serialization/deserialization support
with Serde.
2025-08-22 15:27:47 +05:30

28 lines
622 B
Rust

pub trait Min: Sized + Copy {
fn min(self, other: Self) -> Self;
}
macro_rules! impl_min {
($($t:ty),*) => {
$(
impl Min for $t {
fn min(self, other: Self) -> Self {
Ord::min(self, other)
}
}
)*
};
(float $($t:ty),*) => {
$(
impl Min for $t {
fn min(self, other: Self) -> Self {
Self::min(self, other)
}
}
)*
};
}
impl_min!(usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128);
impl_min!(float f32, f64);