pub struct U16CO { /* private fields */ }Implementations§
Source§impl U16CO
impl U16CO
pub const fn try_new(start: u16, end_excl: u16) -> Option<Self>
pub const unsafe fn new_unchecked(start: u16, end_excl: u16) -> Self
Sourcepub const fn checked_from_midpoint_len(mid: u16, len: u16) -> Option<Self>
pub const fn checked_from_midpoint_len(mid: u16, len: u16) -> Option<Self>
Construct a U16CO from a midpoint and a length.
Returns None if the computed interval is invalid or overflows u16.
Sourcepub const fn saturating_from_midpoint_len(mid: u16, len: u16) -> Option<Self>
pub const fn saturating_from_midpoint_len(mid: u16, len: u16) -> Option<Self>
Saturating version: from midpoint + length, keeps start < end_excl
Source§impl U16CO
impl U16CO
pub const fn contains(self, x: u16) -> bool
pub const fn contains_interval(self, other: Self) -> bool
pub const fn intersects(self, other: Self) -> bool
pub const fn is_adjacent(self, other: Self) -> bool
pub const fn is_contiguous_with(self, other: Self) -> bool
Source§impl U16CO
impl U16CO
Sourcepub const fn intersection(self, other: Self) -> Option<Self>
pub const fn intersection(self, other: Self) -> Option<Self>
Returns the intersection of two intervals.
If the intervals do not overlap, returns None.
Sourcepub const fn convex_hull(self, other: Self) -> Self
pub const fn convex_hull(self, other: Self) -> Self
Returns the convex hull (smallest interval containing both) of two intervals.
Always returns a valid U16CO.
Sourcepub const fn between(self, other: Self) -> Option<Self>
pub const fn between(self, other: Self) -> Option<Self>
Returns the interval strictly between two intervals.
If the intervals are contiguous or overlap, returns None.
Sourcepub const fn union(self, other: Self) -> OneTwo<Self>
pub const fn union(self, other: Self) -> OneTwo<Self>
Returns the union of two intervals.
- If intervals are contiguous or overlapping, returns
Onecontaining the merged interval. - Otherwise, returns
Twocontaining both intervals in ascending order.
Sourcepub const fn difference(self, other: Self) -> ZeroOneTwo<Self>
pub const fn difference(self, other: Self) -> ZeroOneTwo<Self>
Returns the difference of two intervals (self - other).
- If no overlap, returns
One(self). - If partial overlap, returns
OneorTwodepending on remaining segments. - If fully contained, returns
Zero.
Sourcepub const fn symmetric_difference(self, other: Self) -> ZeroOneTwo<Self>
pub const fn symmetric_difference(self, other: Self) -> ZeroOneTwo<Self>
Returns the symmetric difference of two intervals.
Equivalent to (self - other) ∪ (other - self).
- If intervals do not overlap, returns
Two(self, other)in order. - If intervals partially overlap, returns remaining non-overlapping segments as
OneorTwo.
Source§impl U16CO
impl U16CO
Sourcepub const fn checked_minkowski_add(self, other: Self) -> Option<Self>
pub const fn checked_minkowski_add(self, other: Self) -> Option<Self>
Minkowski addition: [a_start, a_end) + [b_start, b_end)
Sourcepub const fn checked_minkowski_sub(self, other: Self) -> Option<Self>
pub const fn checked_minkowski_sub(self, other: Self) -> Option<Self>
Minkowski subtraction: [a_start, a_end) - [b_start, b_end)
Sourcepub const fn checked_minkowski_mul_hull(self, other: Self) -> Option<Self>
pub const fn checked_minkowski_mul_hull(self, other: Self) -> Option<Self>
Minkowski multiplication: [a_start, a_end) * [b_start, b_end)
Sourcepub const fn checked_minkowski_div_hull(self, other: Self) -> Option<Self>
pub const fn checked_minkowski_div_hull(self, other: Self) -> Option<Self>
Minkowski division: [a_start, a_end) / [b_start, b_end)
Source§impl U16CO
impl U16CO
Sourcepub const fn checked_minkowski_add_scalar(self, n: u16) -> Option<Self>
pub const fn checked_minkowski_add_scalar(self, n: u16) -> Option<Self>
Add a scalar to an interval: [start, end) + n
Sourcepub const fn checked_minkowski_sub_scalar(self, n: u16) -> Option<Self>
pub const fn checked_minkowski_sub_scalar(self, n: u16) -> Option<Self>
Subtract a scalar from an interval: [start, end) - n
Sourcepub const fn checked_minkowski_mul_scalar_hull(self, n: u16) -> Option<Self>
pub const fn checked_minkowski_mul_scalar_hull(self, n: u16) -> Option<Self>
Multiply an interval by a scalar: [start, end) * n
Sourcepub const fn checked_minkowski_div_scalar_hull(self, n: u16) -> Option<Self>
pub const fn checked_minkowski_div_scalar_hull(self, n: u16) -> Option<Self>
Divide an interval by a scalar: [start, end) / n
Source§impl U16CO
impl U16CO
pub const fn saturating_minkowski_add(self, other: Self) -> Option<Self>
pub const fn saturating_minkowski_sub(self, other: Self) -> Option<Self>
pub const fn saturating_minkowski_mul_hull(self, other: Self) -> Option<Self>
pub const fn saturating_minkowski_div_hull(self, other: Self) -> Option<Self>
Source§impl U16CO
impl U16CO
Sourcepub const fn saturating_minkowski_add_scalar(self, n: u16) -> Option<Self>
pub const fn saturating_minkowski_add_scalar(self, n: u16) -> Option<Self>
Saturating add scalar: [start, end) + n
Sourcepub const fn saturating_minkowski_sub_scalar(self, n: u16) -> Option<Self>
pub const fn saturating_minkowski_sub_scalar(self, n: u16) -> Option<Self>
Saturating sub scalar: [start, end) - n
Sourcepub const fn saturating_minkowski_mul_scalar_hull(self, n: u16) -> Option<Self>
pub const fn saturating_minkowski_mul_scalar_hull(self, n: u16) -> Option<Self>
Saturating mul scalar: [start, end) * n
Sourcepub const fn saturating_minkowski_div_scalar_hull(self, n: u16) -> Option<Self>
pub const fn saturating_minkowski_div_scalar_hull(self, n: u16) -> Option<Self>
Saturating div scalar: [start, end) / n
Trait Implementations§
Source§impl COAlgebra for U16CO
impl COAlgebra for U16CO
Source§fn intersection(self, other: Self) -> Option<Self>
fn intersection(self, other: Self) -> Option<Self>
Source§fn convex_hull(self, other: Self) -> Self
fn convex_hull(self, other: Self) -> Self
Source§fn between(self, other: Self) -> Option<Self>
fn between(self, other: Self) -> Option<Self>
Source§fn difference(self, other: Self) -> ZeroOneTwo<Self>
fn difference(self, other: Self) -> ZeroOneTwo<Self>
self \ other. Read moreSource§fn symmetric_difference(self, other: Self) -> ZeroOneTwo<Self>
fn symmetric_difference(self, other: Self) -> ZeroOneTwo<Self>
Source§impl COCheckedMinkowskiHull for U16CO
impl COCheckedMinkowskiHull for U16CO
Source§fn checked_minkowski_mul_hull(self, other: Self) -> Option<Self>
fn checked_minkowski_mul_hull(self, other: Self) -> Option<Self>
self * other.Source§fn checked_minkowski_div_hull(self, other: Self) -> Option<Self>
fn checked_minkowski_div_hull(self, other: Self) -> Option<Self>
self / other.Source§fn checked_minkowski_mul_scalar_hull(self, scalar: u16) -> Option<Self>
fn checked_minkowski_mul_scalar_hull(self, scalar: u16) -> Option<Self>
self * scalar.Source§fn checked_minkowski_div_scalar_hull(self, scalar: u16) -> Option<Self>
fn checked_minkowski_div_scalar_hull(self, scalar: u16) -> Option<Self>
self / scalar.Source§impl COCheckedMinkowskiLinear for U16CO
impl COCheckedMinkowskiLinear for U16CO
Source§fn checked_minkowski_add(self, other: Self) -> Option<Self>
fn checked_minkowski_add(self, other: Self) -> Option<Self>
self + other.Source§fn checked_minkowski_sub(self, other: Self) -> Option<Self>
fn checked_minkowski_sub(self, other: Self) -> Option<Self>
self - other.Source§fn checked_minkowski_add_scalar(self, scalar: u16) -> Option<Self>
fn checked_minkowski_add_scalar(self, scalar: u16) -> Option<Self>
self + scalar.Source§fn checked_minkowski_sub_scalar(self, scalar: u16) -> Option<Self>
fn checked_minkowski_sub_scalar(self, scalar: u16) -> Option<Self>
self - scalar.Source§impl COConstruct for U16CO
impl COConstruct for U16CO
Source§impl COMidpoint for U16CO
impl COMidpoint for U16CO
Source§impl COMidpointConstruct for U16CO
impl COMidpointConstruct for U16CO
Source§impl COPredicates for U16CO
impl COPredicates for U16CO
Source§fn contains_interval(self, other: Self) -> bool
fn contains_interval(self, other: Self) -> bool
other is fully contained in this interval.Source§fn intersects(self, other: Self) -> bool
fn intersects(self, other: Self) -> bool
other overlap with positive length.Source§fn is_adjacent(self, other: Self) -> bool
fn is_adjacent(self, other: Self) -> bool
other touch at exactly one boundary
without overlapping.Source§fn is_contiguous_with(self, other: Self) -> bool
fn is_contiguous_with(self, other: Self) -> bool
other overlap or are adjacent.Source§impl COSaturatingMinkowskiHull for U16CO
impl COSaturatingMinkowskiHull for U16CO
Source§fn saturating_minkowski_mul_hull(self, other: Self) -> Option<Self>
fn saturating_minkowski_mul_hull(self, other: Self) -> Option<Self>
self * other. Read moreSource§fn saturating_minkowski_div_hull(self, other: Self) -> Option<Self>
fn saturating_minkowski_div_hull(self, other: Self) -> Option<Self>
self / other. Read moreSource§impl COSaturatingMinkowskiLinear for U16CO
impl COSaturatingMinkowskiLinear for U16CO
Source§fn saturating_minkowski_add(self, other: Self) -> Option<Self>
fn saturating_minkowski_add(self, other: Self) -> Option<Self>
self + other. Read moreSource§fn saturating_minkowski_sub(self, other: Self) -> Option<Self>
fn saturating_minkowski_sub(self, other: Self) -> Option<Self>
self - other. Read more