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§
Sourcefn intersect_ext(&self, other: &U) -> IntersectionExt
fn intersect_ext(&self, other: &U) -> IntersectionExt
Return extended intersection between the two ranges, from the point of the first range.
Sourcefn intersect(&self, other: &U) -> Intersection
fn intersect(&self, other: &U) -> Intersection
Return the intersection between the two ranges.
Sourcefn does_intersect(&self, other: &U) -> bool
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>
impl<T: PartialOrd + Copy> Intersect<T, Range<T>> for Range<T>
Source§fn intersect_ext(&self, other: &Range<T>) -> IntersectionExt
fn intersect_ext(&self, other: &Range<T>) -> IntersectionExt
Determines and returns the IntersectionExt between two ranges.
fn intersect(&self, other: &Range<T>) -> Intersection
fn does_intersect(&self, other: &Range<T>) -> bool
Source§impl<T: PartialOrd + Copy> Intersect<T, RangeFrom<T>> for Range<T>
impl<T: PartialOrd + Copy> Intersect<T, RangeFrom<T>> for Range<T>
Source§fn intersect_ext(&self, other: &RangeFrom<T>) -> IntersectionExt
fn intersect_ext(&self, other: &RangeFrom<T>) -> IntersectionExt
Determines and returns the IntersectionExt between a bounded range and a range starting from a value.
fn intersect(&self, other: &RangeFrom<T>) -> Intersection
fn does_intersect(&self, other: &RangeFrom<T>) -> bool
Source§impl<T: PartialOrd + Copy> Intersect<T, RangeInclusive<T>> for RangeInclusive<T>
impl<T: PartialOrd + Copy> Intersect<T, RangeInclusive<T>> for RangeInclusive<T>
fn intersect_ext(&self, other: &RangeInclusive<T>) -> IntersectionExt
fn intersect(&self, other: &RangeInclusive<T>) -> Intersection
fn does_intersect(&self, other: &RangeInclusive<T>) -> bool
Source§impl<T: PartialOrd + Copy> Intersect<T, RangeTo<T>> for Range<T>
impl<T: PartialOrd + Copy> Intersect<T, RangeTo<T>> for Range<T>
Source§fn intersect_ext(&self, other: &RangeTo<T>) -> IntersectionExt
fn intersect_ext(&self, other: &RangeTo<T>) -> IntersectionExt
Determines and returns the IntersectionExt between a bounded range and a range ending at a value.
fn intersect(&self, other: &RangeTo<T>) -> Intersection
fn does_intersect(&self, other: &RangeTo<T>) -> bool
Source§impl<T: PartialOrd> Intersect<T, RangeFull> for Range<T>
impl<T: PartialOrd> Intersect<T, RangeFull> for Range<T>
Source§fn intersect_ext(&self, _: &RangeFull) -> IntersectionExt
fn intersect_ext(&self, _: &RangeFull) -> IntersectionExt
A range is always within a full range, so always return IntersectionFull::Within.