regex_syntax::hir::interval

Trait Interval

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

Source

fn lower(&self) -> Self::Bound

Source

fn upper(&self) -> Self::Bound

Source

fn set_lower(&mut self, bound: Self::Bound)

Source

fn set_upper(&mut self, bound: Self::Bound)

Source

fn case_fold_simple( &self, intervals: &mut Vec<Self>, ) -> Result<(), CaseFoldError>

Provided Methods§

Source

fn create(lower: Self::Bound, upper: Self::Bound) -> Self

Create a new interval.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Returns true if and only if this range is a subset of the other range.

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§