pub struct I128CO { /* private fields */ }Implementations§
Source§impl I128CO
impl I128CO
pub const fn try_new(start: i128, end_excl: i128) -> Option<Self>
pub const unsafe fn new_unchecked(start: i128, end_excl: i128) -> Self
Sourcepub const fn checked_from_midpoint_len(mid: i128, len: u128) -> Option<Self>
pub const fn checked_from_midpoint_len(mid: i128, len: u128) -> Option<Self>
Constructs an I128CO interval from a midpoint and length (u128).
§Parameters
mid: the desired midpoint of the intervallen: the desired length of the interval in units, must be1..=u128::MAX
§Returns
Some(I128CO)if the interval[start, end_excl)can be represented ini128Noneiflen = 0or the computedstart/end_exclwould overflowi128
§Guarantees
- Returned interval satisfies
start < end_excl - Maximum accepted input length is
u128::MAX
Sourcepub const fn saturating_from_midpoint_len(mid: i128, len: u128) -> Option<Self>
pub const fn saturating_from_midpoint_len(mid: i128, len: u128) -> Option<Self>
Constructs an I128CO interval from a midpoint and length (u128) with saturating semantics.
§Parameters
mid: the desired midpoint of the intervallen: the desired length of the interval in units, must be1..=u128::MAX
§Behavior
- Values are saturated at
i128::MIN/i128::MAXto prevent overflow. - If
len = 0, returnsNone.
§Guarantees
- Returned interval satisfies
start < end_excl - Maximum accepted input length is
u128::MAX - Fully compatible with codegen for other signed integer interval types
Source§impl I128CO
impl I128CO
pub const fn start(self) -> i128
pub const fn end_excl(self) -> i128
pub const fn end_incl(self) -> i128
pub const fn len(self) -> u128
Sourcepub const fn midpoint(self) -> i128
pub const fn midpoint(self) -> i128
Returns the midpoint of the interval [start, end_excl),
using floor division if the length is even.
§Guarantees
midpoint()∈[self.start, self.end_excl - 1]- Works for intervals with maximum length (entire
i128range)
pub const fn contains(self, x: i128) -> bool
pub const fn contains_interval(self, other: Self) -> bool
pub const fn iter(self) -> Range<i128>
pub const fn to_range(self) -> Range<i128>
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 I128CO
impl I128CO
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 I128CO.
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 I128CO
impl I128CO
pub const fn checked_minkowski_add(self, other: Self) -> Option<Self>
pub const fn checked_minkowski_sub(self, other: Self) -> Option<Self>
pub const fn checked_minkowski_mul_hull(self, other: Self) -> Option<Self>
pub const fn checked_minkowski_div_hull(self, other: Self) -> Option<Self>
Source§impl I128CO
impl I128CO
pub const fn checked_minkowski_add_scalar(self, n: i128) -> Option<Self>
pub const fn checked_minkowski_sub_scalar(self, n: i128) -> Option<Self>
pub const fn checked_minkowski_mul_scalar_hull(self, n: i128) -> Option<Self>
pub const fn checked_minkowski_div_scalar_hull(self, n: i128) -> Option<Self>
Source§impl I128CO
impl I128CO
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 I128CO
impl I128CO
pub const fn saturating_minkowski_add_scalar(self, n: i128) -> Option<Self>
pub const fn saturating_minkowski_sub_scalar(self, n: i128) -> Option<Self>
pub const fn saturating_minkowski_mul_scalar_hull(self, n: i128) -> Option<Self>
pub const fn saturating_minkowski_div_scalar_hull(self, n: i128) -> Option<Self>
Trait Implementations§
Source§impl COAlgebra for I128CO
impl COAlgebra for I128CO
Source§fn intersection(self, other: Self) -> Option<Self>
fn intersection(self, other: Self) -> Option<Self>
Returns the overlapping region of two intervals, if any.
Source§fn convex_hull(self, other: Self) -> Self
fn convex_hull(self, other: Self) -> Self
Returns the smallest interval containing both intervals.
Source§fn between(self, other: Self) -> Option<Self>
fn between(self, other: Self) -> Option<Self>
Returns the interval strictly between two separated intervals. Read more
Source§fn difference(self, other: Self) -> ZeroOneTwo<Self>
fn difference(self, other: Self) -> ZeroOneTwo<Self>
Returns
self \ other. Read moreSource§fn symmetric_difference(self, other: Self) -> ZeroOneTwo<Self>
fn symmetric_difference(self, other: Self) -> ZeroOneTwo<Self>
Returns the symmetric difference of two intervals. Read more
Source§impl COCheckedMinkowskiHull for I128CO
impl COCheckedMinkowskiHull for I128CO
Source§fn checked_minkowski_mul_hull(self, other: Self) -> Option<Self>
fn checked_minkowski_mul_hull(self, other: Self) -> Option<Self>
Returns the interval hull containing every point in
self * other.Source§fn checked_minkowski_div_hull(self, other: Self) -> Option<Self>
fn checked_minkowski_div_hull(self, other: Self) -> Option<Self>
Returns the interval hull containing every point in
self / other.Source§fn checked_minkowski_mul_scalar_hull(self, scalar: i128) -> Option<Self>
fn checked_minkowski_mul_scalar_hull(self, scalar: i128) -> Option<Self>
Returns the interval hull containing every point in
self * scalar.Source§fn checked_minkowski_div_scalar_hull(self, scalar: i128) -> Option<Self>
fn checked_minkowski_div_scalar_hull(self, scalar: i128) -> Option<Self>
Returns the interval hull containing every point in
self / scalar.Source§impl COCheckedMinkowskiLinear for I128CO
impl COCheckedMinkowskiLinear for I128CO
Source§fn checked_minkowski_add(self, other: Self) -> Option<Self>
fn checked_minkowski_add(self, other: Self) -> Option<Self>
Returns the exact Minkowski sum
self + other.Source§fn checked_minkowski_sub(self, other: Self) -> Option<Self>
fn checked_minkowski_sub(self, other: Self) -> Option<Self>
Returns the exact Minkowski subtraction
self - other.Source§fn checked_minkowski_add_scalar(self, scalar: i128) -> Option<Self>
fn checked_minkowski_add_scalar(self, scalar: i128) -> Option<Self>
Returns the exact translation
self + scalar.Source§fn checked_minkowski_sub_scalar(self, scalar: i128) -> Option<Self>
fn checked_minkowski_sub_scalar(self, scalar: i128) -> Option<Self>
Returns the exact translation
self - scalar.Source§impl COConstruct for I128CO
impl COConstruct for I128CO
Source§impl COMidpoint for I128CO
impl COMidpoint for I128CO
Source§impl COMidpointConstruct for I128CO
impl COMidpointConstruct for I128CO
Source§impl COPredicates for I128CO
impl COPredicates for I128CO
Source§fn contains_interval(self, other: Self) -> bool
fn contains_interval(self, other: Self) -> bool
Returns whether
other is fully contained in this interval.Source§fn intersects(self, other: Self) -> bool
fn intersects(self, other: Self) -> bool
Returns whether this interval and
other overlap with positive length.Source§fn is_adjacent(self, other: Self) -> bool
fn is_adjacent(self, other: Self) -> bool
Returns whether this interval and
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
Returns whether this interval and
other overlap or are adjacent.Source§impl COSaturatingMinkowskiHull for I128CO
impl COSaturatingMinkowskiHull for I128CO
Source§fn saturating_minkowski_mul_hull(self, other: Self) -> Option<Self>
fn saturating_minkowski_mul_hull(self, other: Self) -> Option<Self>
Returns the saturated interval hull of
self * other. Read moreSource§fn saturating_minkowski_div_hull(self, other: Self) -> Option<Self>
fn saturating_minkowski_div_hull(self, other: Self) -> Option<Self>
Returns the saturated interval hull of
self / other. Read moreSource§impl COSaturatingMinkowskiLinear for I128CO
impl COSaturatingMinkowskiLinear for I128CO
Source§fn saturating_minkowski_add(self, other: Self) -> Option<Self>
fn saturating_minkowski_add(self, other: Self) -> Option<Self>
Returns the saturated Minkowski sum
self + other. Read moreSource§fn saturating_minkowski_sub(self, other: Self) -> Option<Self>
fn saturating_minkowski_sub(self, other: Self) -> Option<Self>
Returns the saturated Minkowski subtraction
self - other. Read moreSource§impl Ord for I128CO
impl Ord for I128CO
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for I128CO
impl PartialOrd for I128CO
impl Copy for I128CO
impl Eq for I128CO
impl StructuralPartialEq for I128CO
Auto Trait Implementations§
impl Freeze for I128CO
impl RefUnwindSafe for I128CO
impl Send for I128CO
impl Sync for I128CO
impl Unpin for I128CO
impl UnsafeUnpin for I128CO
impl UnwindSafe for I128CO
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more