pub trait RangeOps<T>: RangeBounds<T> {
    // Required methods
    fn is_empty(&self) -> bool;
    fn is_disjoint_from(&self, other: &impl RangeBounds<T>) -> bool;
    fn intersects(&self, other: &impl RangeBounds<T>) -> bool;
    fn is_before(&self, other: &impl RangeBounds<T>) -> bool;
    fn is_after(&self, other: &impl RangeBounds<T>) -> bool;
    fn begins_within(&self, other: &impl RangeBounds<T>) -> bool;
    fn ends_within(&self, other: &impl RangeBounds<T>) -> bool;
    fn contains_range(&self, other: &impl RangeBounds<T>) -> bool;
    fn is_contained_by(&self, other: &impl RangeBounds<T>) -> bool;
}
Expand description

Convenient interval comparisons.

Required Methods§

source

fn is_empty(&self) -> bool

Checks if an interval is empty.

source

fn is_disjoint_from(&self, other: &impl RangeBounds<T>) -> bool

Checks if an interval has no overlap with another.

source

fn intersects(&self, other: &impl RangeBounds<T>) -> bool

Checks if this interval has some overlap with another.

source

fn is_before(&self, other: &impl RangeBounds<T>) -> bool

Checks if this interval ends before the start of another.

source

fn is_after(&self, other: &impl RangeBounds<T>) -> bool

Checks if this interval starts after the end of another.

source

fn begins_within(&self, other: &impl RangeBounds<T>) -> bool

Checks if this interval starts within another.

source

fn ends_within(&self, other: &impl RangeBounds<T>) -> bool

Checks if this interval ends within another.

source

fn contains_range(&self, other: &impl RangeBounds<T>) -> bool

Checks if this interval contains another.

source

fn is_contained_by(&self, other: &impl RangeBounds<T>) -> bool

Checks if this interval is contained by another.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, R> RangeOps<T> for R
where T: PartialOrd, R: RangeBounds<T>,