Trait Intersect

Source
pub trait Intersect<T: PartialOrd, U: RangeBounds<T>>: RangeBounds<T> {
    // Required methods
    fn intersect_ext(&self, other: &U) -> IntersectionExt;
    fn intersect(&self, other: &U) -> Intersection;
    fn does_intersect(&self, other: &U) -> bool;
}
Expand description

A type implementing this trait can return the intersection between itself and another range.

Required Methods§

Source

fn intersect_ext(&self, other: &U) -> IntersectionExt

Return extended intersection between the two ranges, from the point of the first range.

Source

fn intersect(&self, other: &U) -> Intersection

Return the intersection between the two ranges.

Source

fn does_intersect(&self, other: &U) -> bool

Checks if the two ranges intersect.

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: PartialOrd + Copy> Intersect<T, Range<T>> for Range<T>

Source§

fn intersect_ext(&self, other: &Range<T>) -> IntersectionExt

Determines and returns the IntersectionExt between two ranges.

Source§

fn intersect(&self, other: &Range<T>) -> Intersection

Source§

fn does_intersect(&self, other: &Range<T>) -> bool

Source§

impl<T: PartialOrd + Copy> Intersect<T, RangeFrom<T>> for Range<T>

Source§

fn intersect_ext(&self, other: &RangeFrom<T>) -> IntersectionExt

Determines and returns the IntersectionExt between a bounded range and a range starting from a value.

Source§

fn intersect(&self, other: &RangeFrom<T>) -> Intersection

Source§

fn does_intersect(&self, other: &RangeFrom<T>) -> bool

Source§

impl<T: PartialOrd + Copy> Intersect<T, RangeInclusive<T>> for RangeInclusive<T>

Source§

impl<T: PartialOrd + Copy> Intersect<T, RangeTo<T>> for Range<T>

Source§

fn intersect_ext(&self, other: &RangeTo<T>) -> IntersectionExt

Determines and returns the IntersectionExt between a bounded range and a range ending at a value.

Source§

fn intersect(&self, other: &RangeTo<T>) -> Intersection

Source§

fn does_intersect(&self, other: &RangeTo<T>) -> bool

Source§

impl<T: PartialOrd> Intersect<T, RangeFull> for Range<T>

Source§

fn intersect_ext(&self, _: &RangeFull) -> IntersectionExt

A range is always within a full range, so always return IntersectionFull::Within.

Source§

fn intersect(&self, _: &RangeFull) -> Intersection

Source§

fn does_intersect(&self, _: &RangeFull) -> bool

Implementors§