MCPcopy Create free account
hub / github.com/davidblewett/rure-python / intersect

Method intersect

regex/regex-syntax/src/hir/interval.rs:365–373  ·  view source on GitHub ↗

Intersect this range with the given range and return the result. If the intersection is empty, then this returns `None`.

(&self, other: &Self)

Source from the content-addressed store, hash-verified

363 ///
364 /// If the intersection is empty, then this returns `None`.
365 fn intersect(&self, other: &Self) -> Option<Self> {
366 let lower = cmp::max(self.lower(), other.lower());
367 let upper = cmp::min(self.upper(), other.upper());
368 if lower <= upper {
369 Some(Self::create(lower, upper))
370 } else {
371 None
372 }
373 }
374
375 /// Subtract the given range from this range and return the resulting
376 /// ranges.

Callers

nothing calls this directly

Implementers 1

mod.rsregex/regex-syntax/src/hir/mod.rs

Calls 2

lowerMethod · 0.80
upperMethod · 0.80

Tested by

no test coverage detected