fn vars(&self) -> HashSet<Variable> {
        match self {
            Type::Unit | Type::Bool | Type::Int => HashSet::new(),
            Type::Func(ty1, ty2) => {
                let mut s1 = ty1.vars();
                let mut s2 = ty2.vars();
                s1.extend(s2.drain());
                s1
            },
            Type::Tuple(f, s, r) => {
                let mut fv = f.vars();
                let mut sv = s.vars();
                let mut rv = r.iter().flat_map(|t| t.vars()).collect::<HashSet<_>>();
                fv.extend(sv.drain());
                fv.extend(rv.drain());
                fv
            },
            Type::Var(v) => {
                let mut s = HashSet::with_capacity(1);
                s.insert(v.clone());
                s
            },
        }
    }
/// Collect all variables contained in type
Collect all variables contained in type
Collect all variables contained in type
fn vars(&self) -> HashSet<Variable> {
        match self {
            Type::Unit | Type::Bool | Type::Int => HashSet::new(),
            Type::Func(ty1, ty2) => {
                let mut s1 = ty1.vars();
                let mut s2 = ty2.vars();
                s1.extend(s2.drain());
                s1
            },
            Type::Tuple(f, s, r) => {
                let mut fv = f.vars();
                let mut sv = s.vars();
                let mut rv = r.iter().flat_map(|t| t.vars()).collect::<HashSet<_>>();
                fv.extend(sv.drain());
                fv.extend(rv.drain());
                fv
            },
            Type::Var(v) => {
                let mut s = HashSet::with_capacity(1);
                s.insert(v.clone());
                s
            },
        }
    }
fn vars ( & self ) -> HashSet < Variable > { match self { Type :: Unit | Type :: Bool | Type :: Int => HashSet :: new ( ) , Type :: Func ( ty1 , ty2 ) => { let mut s1 = ty1 . vars ( ) ; let mut s2 = ty2 . vars ( ) ; s1 . extend ( s2 . drain ( ) ) ; s1 } , Type :: Tuple ( f , s , r ) => { let mut fv = f . vars ( ) ; let mut sv = s . vars ( ) ; let mut rv = r . iter ( ) . flat_map ( | t | t . vars ( ) ) . collect :: < HashSet < _ > > ( ) ; fv . extend ( sv . drain ( ) ) ; fv . extend ( rv . drain ( ) ) ; fv } , Type :: Var ( v ) => { let mut s = HashSet :: with_capacity ( 1 ) ; s . insert ( v . clone ( ) ) ; s } , } }
Collect all variables contained in type
Collect all variables contained in type
&self
&self