range-compare
This crate provides a method to compare two ranges and get the overlapping parts of the ranges.
Examples
use ;
// create two ranges
let range1 = 2..10;
let range2 = 5..15;
// compare the original range1 with the other range2
// safe the [RangeCmpResult] of the comparison in a variable
let result = range1.compare;
assert_eq!;
Get the matching part of the original range
use ;
// create two ranges
let range1 = 29..40;
let range2 = 35..70;
// compare the original range1 with the other range2
// safe the [RangeCmpResult] of the comparison in a variable
let result = range1.compare;
// get the matching part of the original range
let matching_part = result.get_matching_part;
assert_eq!;