Function check_sorted_ranges_overlap

Source
pub fn check_sorted_ranges_overlap(
    ranges: impl Iterator<Item = RawRange>,
) -> Result<(), OverlapErr>
Expand description

Checks if the given ranges are overlapping.

Returns Err with one of the overlapping range pair if they are overlapping.

The given ranges should be sorted by the start, otherwise it always returns Err.

ยงExample

assert!(check_sorted_ranges_overlap([(0, 10), (10, 10)].into_iter()).is_ok());
assert_eq!(
    check_sorted_ranges_overlap([(0, 10), (5, 10)].into_iter()),
    Err((0..10, 5..15))
);