Function textspan::remove_span_overlaps[][src]

pub fn remove_span_overlaps(spans: &[Span]) -> Vec<Span>

Remove overlapping spans from given spans. First, longest spans are remained - if the two spans are overlapped, the first span will be remained. If the two spans are overlapped and their start positions are same, the longer span will be remained.

Example

use textspan::remove_span_overlaps;
let spans = [(0, 2), (0, 3), (2, 4), (5, 7)];
let ret = remove_span_overlaps(&spans);
assert_eq!(ret, [(0, 3), (5, 7)]);