Trait regex_syntax::hir::interval::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.

Object Safety§

This trait is not object safe.

Implementors§