pub struct BaseInterval<T: Num> { /* private fields */ }Expand description
Interval struct that contains a lowerbound and upperbound without a value or count.
§Examples
use intervalues::{Interval, BaseInterval};
let x = BaseInterval::new(0, 1);
let y = Interval::new(0, 1, 2);
assert_eq!(x.get_lb(), 0);
assert_eq!(x.get_ub(), 1);
assert_eq!(x, y.to_base());Implementations§
Source§impl<T> BaseInterval<T>
impl<T> BaseInterval<T>
pub fn new(lb: T, ub: T) -> Self
pub fn print(&self) -> String
pub fn to_tuple(self) -> (T, T)
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) -> T
pub fn len(self) -> T
pub fn contains(self, num: T) -> bool
pub fn superset(self, other: BaseInterval<T>) -> bool
pub fn subset(self, other: BaseInterval<T>) -> bool
pub fn left_overlaps(&self, other: &BaseInterval<T>) -> bool
pub fn right_overlaps(self, other: &BaseInterval<T>) -> bool
pub fn overlaps(self, other: BaseInterval<T>) -> bool
pub fn can_join(self, other: BaseInterval<T>) -> bool
pub fn join(self, other: BaseInterval<T>) -> BaseInterval<T>
pub fn get_total_value(self) -> T
Trait Implementations§
Source§impl<T: Clone + Num> Clone for BaseInterval<T>
impl<T: Clone + Num> Clone for BaseInterval<T>
Source§fn clone(&self) -> BaseInterval<T>
fn clone(&self) -> BaseInterval<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for BaseInterval<T>
impl<T> Debug for BaseInterval<T>
Source§impl<T> Default for BaseInterval<T>
impl<T> Default for BaseInterval<T>
Source§impl<T> Display for BaseInterval<T>
impl<T> Display for BaseInterval<T>
impl<T: Copy + Num> Copy for BaseInterval<T>
impl<T: Eq + Num> Eq for BaseInterval<T>
impl<T: Num> StructuralPartialEq for BaseInterval<T>
Auto Trait Implementations§
impl<T> Freeze for BaseInterval<T>where
T: Freeze,
impl<T> RefUnwindSafe for BaseInterval<T>where
T: RefUnwindSafe,
impl<T> Send for BaseInterval<T>where
T: Send,
impl<T> Sync for BaseInterval<T>where
T: Sync,
impl<T> Unpin for BaseInterval<T>where
T: Unpin,
impl<T> UnwindSafe for BaseInterval<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 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.