mulch::ranges

Trait RangeIntersect

Source
pub trait RangeIntersect: Sized {
    // Required methods
    fn encompasses(&self, other: Self) -> bool;
    fn intersects(&self, other: Self) -> bool;
    fn intersection(&self, other: Self) -> Option<Self>;
    fn split(&self, other: Self) -> (Option<Self>, Option<Self>, Option<Self>);
}

Required Methods§

Source

fn encompasses(&self, other: Self) -> bool

Returns true if all values in other are within self.

Source

fn intersects(&self, other: Self) -> bool

Source

fn intersection(&self, other: Self) -> Option<Self>

Source

fn split(&self, other: Self) -> (Option<Self>, Option<Self>, Option<Self>)

Split self into three ranges: the portion before other, the intersection, and the portion after other.

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.

Implementations on Foreign Types§

Source§

impl<T> RangeIntersect for Range<T>
where T: Clone + Copy + Ord,

Source§

fn encompasses(&self, other: Self) -> bool

Source§

fn intersects(&self, other: Self) -> bool

Source§

fn intersection(&self, other: Self) -> Option<Self>

Source§

fn split(&self, other: Self) -> (Option<Self>, Option<Self>, Option<Self>)

Implementors§