[][src]Struct gf::support::iv::Iv

pub struct Iv<T: Clone + Integer = u128> { /* fields omitted */ }

Non-empty half-closed interval between two integer points: [ai; bx).

Total order

Intervals have total order: first the leftmost bounds are compared, and ties are solved by comparing rightmost bounds.

Implementations

impl<T: Clone + Integer> Iv<T>[src]

pub fn new(ai: T, bx: T) -> Option<Self>[src]

Create a half-closed interval [ai; bx), returning None if the interval would have been empty.

pub fn new_closed(ai: T, bi: T) -> Option<Self>[src]

Create a closed interval [ai; bi], returning None if the interval would have been empty.

pub fn ai(&self) -> &T[src]

Return the leftmost point of the interval.

pub fn bx(&self) -> &T[src]

Return the leftmost point after the interval.

pub fn len(&self) -> T[src]

Return interval length.

pub fn contains(&self, x: &T) -> bool[src]

Return whether x belongs to the interval.

pub fn contains_iv(&self, iv: &Self) -> bool[src]

Return whether iv lies completely within the interval.

pub fn intersects(&self, other: &Self) -> bool[src]

Return whether this interval and other have a non-empty intersection.

pub fn checked_add(self, offset: T) -> Option<Self> where
    T: CheckedAdd
[src]

Add offset to both ends of the interval, checking for overflow.

pub fn checked_sub(self, offset: T) -> Option<Self> where
    T: CheckedSub
[src]

Subtract offset from both ends of the interval, checking for overflow.

Trait Implementations

impl<T: Clone + Integer> Add<T> for Iv<T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<T: Clone + Integer> Clone for Iv<T>[src]

impl<T: Clone + Integer + Debug> Debug for Iv<T>[src]

impl<T: Clone + Integer + Display> Display for Iv<T>[src]

impl<T: Eq + Clone + Integer> Eq for Iv<T>[src]

impl<T: Clone + Integer> From<Iv<T>> for Range<T>[src]

impl<T: Hash + Clone + Integer> Hash for Iv<T>[src]

impl<T: Clone + Integer> Ord for Iv<T>[src]

impl<T: PartialEq + Clone + Integer> PartialEq<Iv<T>> for Iv<T>[src]

impl<T: Clone + Integer> PartialOrd<Iv<T>> for Iv<T>[src]

impl<T: Clone + Integer> StructuralEq for Iv<T>[src]

impl<T: Clone + Integer> StructuralPartialEq for Iv<T>[src]

impl<T: Clone + Integer> Sub<T> for Iv<T>[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

impl<T> RefUnwindSafe for Iv<T> where
    T: RefUnwindSafe

impl<T> Send for Iv<T> where
    T: Send

impl<T> Sync for Iv<T> where
    T: Sync

impl<T> Unpin for Iv<T> where
    T: Unpin

impl<T> UnwindSafe for Iv<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.