diff options
| author | superwhiskers <[email protected]> | 2025-09-15 13:38:14 -0500 |
|---|---|---|
| committer | superwhiskers <[email protected]> | 2026-01-04 22:23:01 -0600 |
| commit | e12b1f4459aee80ee333e90e3b56a3b09f81ae3e (patch) | |
| tree | 872402360b490c992bb0d7e071ab2834adeae03e /crates/core/src/hive/skipfield.rs | |
| parent | 50192cbe91da765d3c09cf8e12f328b721d3cb46 (diff) | |
| download | azimuth-e12b1f4459aee80ee333e90e3b56a3b09f81ae3e.tar.gz azimuth-e12b1f4459aee80ee333e90e3b56a3b09f81ae3e.tar.bz2 azimuth-e12b1f4459aee80ee333e90e3b56a3b09f81ae3e.zip | |
node topological sorting
Change-Id: I6a6a6964255d818be1bf9a8f4ec9e317befa19c5
Diffstat (limited to 'crates/core/src/hive/skipfield.rs')
| -rw-r--r-- | crates/core/src/hive/skipfield.rs | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/crates/core/src/hive/skipfield.rs b/crates/core/src/hive/skipfield.rs deleted file mode 100644 index 16a3dcb..0000000 --- a/crates/core/src/hive/skipfield.rs +++ /dev/null @@ -1,67 +0,0 @@ -//! An implementation of a trait describing valid skipfield integer types. -//! -//! Only `u16`s and `u8`s are supported by default. However, other integral -//! types may be used by implementing this trait on them; the trait is not -//! sealed. - -use core::{ - cmp, - ops::{Add, AddAssign, Sub, SubAssign}, -}; - -/// Trait describing integral types in a generic way suitable for use as the -/// element type of a skipfield. -pub trait SkipfieldType: - Add + AddAssign + Sub + SubAssign + Ord + PartialOrd + Copy + Sized -{ - /// The maximum attainable value of this type. - const MAXIMUM: Self; - - /// The zero element of this type. - const ZERO: Self; - - /// The one element of this type. - const ONE: Self; - - /// Conversion method from `usize` using `as` or an equivalent - /// - /// Caps the value of the input by the maximum of `Self`. - fn from_usize(u: usize) -> Self; - - /// Conversion method from `isize` using `as` or an equivalent - /// - /// Caps the value of the input by the maximum of `Self`. - fn from_isize(i: isize) -> Self; -} - -impl SkipfieldType for u16 { - const MAXIMUM: Self = u16::MAX; - const ZERO: Self = 0; - const ONE: Self = 1; - - #[inline(always)] - fn from_usize(u: usize) -> Self { - cmp::min(u, Self::MAXIMUM as usize) as u16 - } - - #[inline(always)] - fn from_isize(i: isize) -> Self { - cmp::min(i, Self::MAXIMUM as isize) as u16 - } -} - -impl SkipfieldType for u8 { - const MAXIMUM: Self = u8::MAX; - const ZERO: Self = 0; - const ONE: Self = 1; - - #[inline(always)] - fn from_usize(u: usize) -> Self { - cmp::min(u, Self::MAXIMUM as usize) as u8 - } - - #[inline(always)] - fn from_isize(i: isize) -> Self { - cmp::min(i, Self::MAXIMUM as isize) as u8 - } -} |
