pub struct Bound<T>(/* private fields */);Expand description
Defines the Bound or limit that constrains a Set.
An Open(limit) does not include limit as an element of the set, while a Closed(limit) does.
Implementations§
Source§impl<T: Clone + PartialOrd> Bound<T>
impl<T: Clone + PartialOrd> Bound<T>
Sourcepub fn min_left(a: &Self, b: &Self) -> Self
pub fn min_left(a: &Self, b: &Self) -> Self
Returns the smaller Bound, treating args as left hand (lower) bounds.
Sourcepub fn min_right(a: &Self, b: &Self) -> Self
pub fn min_right(a: &Self, b: &Self) -> Self
Returns the smaller Bound, treating args as right hand (upper) bounds.
Sourcepub fn max_left(a: &Self, b: &Self) -> Self
pub fn max_left(a: &Self, b: &Self) -> Self
Returns the larger Bound, treating args as left hand (lower) bounds.
Source§impl<T> Bound<T>
impl<T> Bound<T>
Sourcepub fn map<U>(&self, func: impl FnOnce(&T) -> U) -> Bound<U>
pub fn map<U>(&self, func: impl FnOnce(&T) -> U) -> Bound<U>
Returns a new Bound, retaining BoundType, with a new limit.
§Examples
use intervalsets::Bound;
let bound = Bound::closed(10);
let shift = bound.map(|limit| limit + 10);
assert_eq!(shift, Bound::closed(20));
let float = bound.map(|limit| *limit as f32);
assert_eq!(float, Bound::closed(10.0));Sourcepub fn bound_type(&self) -> BoundType
pub fn bound_type(&self) -> BoundType
Return the BoundType of this Bound.
Sourcepub fn binary_map(self, func: impl Fn(T, T) -> T, rhs: T) -> Self
pub fn binary_map(self, func: impl Fn(T, T) -> T, rhs: T) -> Self
Map a binary operation over Bound<T>. self is consumed.
Trait Implementations§
impl<T: Eq> Eq for Bound<T>
impl<T> StructuralPartialEq for Bound<T>
Auto Trait Implementations§
impl<T> Freeze for Bound<T>where
T: Freeze,
impl<T> RefUnwindSafe for Bound<T>where
T: RefUnwindSafe,
impl<T> Send for Bound<T>where
T: Send,
impl<T> Sync for Bound<T>where
T: Sync,
impl<T> Unpin for Bound<T>where
T: Unpin,
impl<T> UnwindSafe for Bound<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more