/**
    Extends an interval to span it and another one.

    # Example

    ```
    use advanced_collections::interval::Interval;
    fn main() {
       let mut a = Interval::closed(2,3);
       let b = Interval::closed(5,6);
       a.span(b);
       assert_eq!(a, Interval::closed(2,6));
    }
    ```
    */
Extends an interval to span it and another one.
Extends an interval to span it and another one .
pub fn span(&mut self, mut other: Self) {
        if other.is_empty() {
            return;
        }
        if self.is_empty() {
            swap(self, &mut other);
            return;
        }
        let s = self.imp.as_mut().unwrap();
        let o = other .imp.as_mut().unwrap();
        if o.lo < s.lo {
            swap(&mut o.lo, &mut s.lo);
        }
        if o.up > s.up {
            swap(&mut s.up, &mut o.up);
        }
    }
pub fn span ( & mut self , mut other : Self ) { if other . is_empty ( ) { return ; } if self . is_empty ( ) { swap ( self , & mut other ) ; return ; } let s = self . imp . as_mut ( ) . unwrap ( ) ; let o = other . imp . as_mut ( ) . unwrap ( ) ; if o . lo < s . lo { swap ( & mut o . lo , & mut s . lo ) ; } if o . up > s . up { swap ( & mut s . up , & mut o . up ) ; } }
Extends an interval to span it and another one.
Extends an interval to span it and another one .
&mut self
other
Self
example
```
use advanced_collections::interval::Interval;
fn main() {
let mut a = Interval::closed(2,3);
let b = Interval::closed(5,6);
a.span(b);
assert_eq!(a, Interval::closed(2,6));
}
```
` ` ` use advanced_collections :: interval :: Interval ; fn main () { let mut a = Interval :: closed ( 2 3 ) ; let b = Interval :: closed ( 5 6 ) ; a . span ( b ) ; assert_eq! ( a Interval :: closed ( 2 6 )) ; } ` ` `