pub struct Interval<T: Num, U: Num> { /* private fields */ }Expand description
Interval struct that contains a lowerbound, upperbound and value/count of the range within the interval. These can be aggregated together using intervalues::combine_intervals().
§Examples
use intervalues::Interval;
let x = Interval::new(0, 1, 2.5);
assert_eq!(x.get_lb(), 0);
assert_eq!(x.get_ub(), 1);
assert_eq!(x.get_value(), 2.5);Implementations§
Source§impl<T, U> Interval<T, U>
impl<T, U> Interval<T, U>
pub fn new(lb: T, ub: T, val: U) -> Self
pub fn print(&self) -> String
pub fn to_tuple(self) -> (T, T, U)
pub fn get_bounds(self) -> (T, T)
pub fn get_lb(self) -> T
pub fn get_ub(self) -> T
pub fn get_width(self) -> T
pub fn get_value(self) -> U
pub fn len(self) -> T
pub fn contains(self, num: T) -> bool
pub fn superset(self, other: Interval<T, U>) -> bool
pub fn subset(self, other: Interval<T, U>) -> bool
pub fn left_overlaps(&self, other: &Interval<T, U>) -> bool
pub fn right_overlaps(self, other: &Interval<T, U>) -> bool
pub fn overlaps(self, other: &Interval<T, U>) -> bool
pub fn can_join(self, other: &Interval<T, U>) -> bool
pub fn join(self, other: Interval<T, U>) -> Interval<T, U>
pub fn can_join_as_set(self, other: &Interval<T, U>) -> bool
pub fn join_ign_value(self, other: Interval<T, U>) -> Interval<T, U>
pub fn join_as_set(self, other: Interval<T, U>) -> BaseInterval<T>
pub fn to_base(self) -> BaseInterval<T>
Trait Implementations§
impl<T: Copy + Num, U: Copy + Num> Copy for Interval<T, U>
impl<T: Eq + Num, U: Eq + Num> Eq for Interval<T, U>
impl<T: Num, U: Num> StructuralPartialEq for Interval<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for Interval<T, U>
impl<T, U> RefUnwindSafe for Interval<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Interval<T, U>
impl<T, U> Sync for Interval<T, U>
impl<T, U> Unpin for Interval<T, U>
impl<T, U> UnwindSafe for Interval<T, U>where
T: UnwindSafe,
U: 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 moreSource§impl<F> Match for F
impl<F> Match for F
Source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true if self can be cast into the target type T.Source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
Source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value can be cast into Self.Source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self) if the source value can be cast into Self, otherwise None.Source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
Source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self can be cast into T.Source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T) if self can be cast into T, otherwise None.Source§fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>where
OnErr: FnOnce(&Self) -> Err,
Returns
Ok(T) if self can be cast into T, otherwise calls on_err.