pub trait Interval:
Clone
+ Copy
+ Debug
+ Default
+ Eq
+ PartialEq
+ PartialOrd
+ Ord {
type Bound: Bound;
// Required methods
fn lower(&self) -> Self::Bound;
fn upper(&self) -> Self::Bound;
fn set_lower(&mut self, bound: Self::Bound);
fn set_upper(&mut self, bound: Self::Bound);
fn case_fold_simple(
&self,
intervals: &mut Vec<Self>,
) -> Result<(), CaseFoldError>;
// Provided methods
fn create(lower: Self::Bound, upper: Self::Bound) -> Self { ... }
fn union(&self, other: &Self) -> Option<Self> { ... }
fn intersect(&self, other: &Self) -> Option<Self> { ... }
fn difference(&self, other: &Self) -> (Option<Self>, Option<Self>) { ... }
fn is_contiguous(&self, other: &Self) -> bool { ... }
fn is_intersection_empty(&self, other: &Self) -> bool { ... }
fn is_subset(&self, other: &Self) -> bool { ... }
}
Required Associated Types§
Required Methods§
fn lower(&self) -> Self::Bound
fn upper(&self) -> Self::Bound
fn set_lower(&mut self, bound: Self::Bound)
fn set_upper(&mut self, bound: Self::Bound)
fn case_fold_simple( &self, intervals: &mut Vec<Self>, ) -> Result<(), CaseFoldError>
Provided Methods§
Sourcefn union(&self, other: &Self) -> Option<Self>
fn union(&self, other: &Self) -> Option<Self>
Union the given overlapping range into this range.
If the two ranges aren’t contiguous, then this returns None
.
Sourcefn intersect(&self, other: &Self) -> Option<Self>
fn intersect(&self, other: &Self) -> Option<Self>
Intersect this range with the given range and return the result.
If the intersection is empty, then this returns None
.
Sourcefn difference(&self, other: &Self) -> (Option<Self>, Option<Self>)
fn difference(&self, other: &Self) -> (Option<Self>, Option<Self>)
Subtract the given range from this range and return the resulting ranges.
If subtraction would result in an empty range, then no ranges are returned.
Sourcefn is_contiguous(&self, other: &Self) -> bool
fn is_contiguous(&self, other: &Self) -> bool
Returns true if and only if the two ranges are contiguous. Two ranges are contiguous if and only if the ranges are either overlapping or adjacent.
Sourcefn is_intersection_empty(&self, other: &Self) -> bool
fn is_intersection_empty(&self, other: &Self) -> bool
Returns true if and only if the intersection of this range and the other range is empty.
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.