Trait RangeOps

Source
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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