/**
    Makes an interval an intersection of it an another one.

    # Example

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