pub fn push(&mut self, start: T, end: T) {
            assert!(end >= start);
            assert!(self
                .intervals
                .iter()
                .last()
                .map_or(true, |(s, _)| *s <= start));
            let overlapping = self.intervals.iter().last().and_then(|(s, e)| {
                if *e >= start {
                    Some((*s, *e))
                } else {
                    None
                }
            });
            match overlapping {
                Some((overlapping_s, overlapping_e)) => self
                    .intervals
                    .insert(overlapping_s, cmp::max(overlapping_e, end)),
                None => self.intervals.insert(start, end),
            };
        }
/// Add a new interval to this tree.
///
/// Start must be >= the start of any previous interval added. Both start
/// and end are inclusive.
Add a new interval to this tree.
Start must be >= the start of any previous interval added. Both start
and end are inclusive.
Add a new interval to this tree . Start must be > = the start of any previous interval added . Both start and end are inclusive .
pub fn push(&mut self, start: T, end: T) {
            assert!(end >= start);
            assert!(self
                .intervals
                .iter()
                .last()
                .map_or(true, |(s, _)| *s <= start));
            let overlapping = self.intervals.iter().last().and_then(|(s, e)| {
                if *e >= start {
                    Some((*s, *e))
                } else {
                    None
                }
            });
            match overlapping {
                Some((overlapping_s, overlapping_e)) => self
                    .intervals
                    .insert(overlapping_s, cmp::max(overlapping_e, end)),
                None => self.intervals.insert(start, end),
            };
        }
pub fn push ( & mut self , start : T , end : T ) { assert ! ( end start ) ; assert ! ( self intervals iter ( ) last ( ) map_or ( true ( s ) s start ) ) ; let overlapping = self . intervals . iter ( ) . last ( ) . and_then ( | ( s , e ) | { if * e >= start { Some ( ( * s , * e ) ) } else { None } } ) ; match overlapping { Some ( ( overlapping_s , overlapping_e ) ) => self . intervals . insert ( overlapping_s , cmp :: max ( overlapping_e , end ) ) , None => self . intervals . insert ( start , end ) , } ; }
Add a new interval to this tree.
Add a new interval to this tree .
&mut self
start
T
end
T
&mut self
start
T
end
T