[−][src]Struct gf::support::iv::Iv
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]
T: CheckedAdd,
Add offset
to both ends of the interval, checking for overflow.
pub fn checked_sub(self, offset: T) -> Option<Self> where
T: CheckedSub,
[src]
T: CheckedSub,
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.
fn add(self, rhs: T) -> Self
[src]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Clone + Integer> Ord for Iv<T>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq + Clone + Integer> PartialEq<Iv<T>> for Iv<T>
[src]
impl<T: Clone + Integer> PartialOrd<Iv<T>> for Iv<T>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[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]
Auto Trait Implementations
impl<T> RefUnwindSafe for Iv<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Iv<T> where
T: Send,
T: Send,
impl<T> Sync for Iv<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Iv<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Iv<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,