pub struct BoundPair<T> { /* private fields */ }
Expand description
A BoundPair represents valid left and right Interval bounds
For Intervals containing finite bounds, the BoundPair construction ensures well-formed left and right bounds prior to Interval enum construction (e.g. left < right).
Implementations§
Source§impl<T> BoundPair<T>where
T: Copy + PartialOrd,
impl<T> BoundPair<T>where
T: Copy + PartialOrd,
Sourcepub fn new(left: T, right: T) -> Option<BoundPair<T>>
pub fn new(left: T, right: T) -> Option<BoundPair<T>>
Create a new Bound Pair with lower and upper bounds.
If the bounds are mal-formed, i.e. !(left < right), return None.
§Examples
use intervals_general::bound_pair::BoundPair;
let bounds = BoundPair::new(1.0, 2.0).ok_or("invalid BoundPair")?;
§Failures
use intervals_general::bound_pair::BoundPair;
assert_eq!(BoundPair::new(2, 1), None);
assert_eq!(BoundPair::new(2.0, 2.0), None);
Trait Implementations§
impl<T: Copy> Copy for BoundPair<T>
impl<T> StructuralPartialEq for BoundPair<T>
Auto Trait Implementations§
impl<T> Freeze for BoundPair<T>where
T: Freeze,
impl<T> RefUnwindSafe for BoundPair<T>where
T: RefUnwindSafe,
impl<T> Send for BoundPair<T>where
T: Send,
impl<T> Sync for BoundPair<T>where
T: Sync,
impl<T> Unpin for BoundPair<T>where
T: Unpin,
impl<T> UnwindSafe for BoundPair<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