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

Method is_contiguous

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

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.

(&self, other: &Self)

Source from the content-addressed store, hash-verified

427 /// are contiguous if and only if the ranges are either overlapping or
428 /// adjacent.
429 fn is_contiguous(&self, other: &Self) -> bool {
430 let lower1 = self.lower().as_u32();
431 let upper1 = self.upper().as_u32();
432 let lower2 = other.lower().as_u32();
433 let upper2 = other.upper().as_u32();
434 cmp::max(lower1, lower2) <= cmp::min(upper1, upper2).saturating_add(1)
435 }
436
437 /// Returns true if and only if the intersection of this range and the
438 /// other range is empty.

Callers 2

is_canonicalMethod · 0.80
unionMethod · 0.80

Implementers 1

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

Calls 3

as_u32Method · 0.80
lowerMethod · 0.80
upperMethod · 0.80

Tested by

no test coverage detected