pub fn insert(&mut self, ty: Type<'a>) -> TypeId {
        if let Some(index) = self.type_to_index.get(&ty).copied() {
            return TypeId { index };
        }

        let index = u32::try_from(self.types.len()).unwrap();
        let ty = Rc::new(ty);
        self.type_to_index.insert(ty.clone(), index);
        self.types.push(ty);
        TypeId { index }
    }
/// Insert a new type into this type set and get its id.
///
/// If the type has already been inserted and assigned an id before, then
/// that entry and its id are reused.
Insert a new type into this type set and get its id.
If the type has already been inserted and assigned an id before, then
that entry and its id are reused.
Insert a new type into this type set and get its id . If the type has already been inserted and assigned an id before then that entry and its id are reused .
pub fn insert(&mut self, ty: Type<'a>) -> TypeId {
        if let Some(index) = self.type_to_index.get(&ty).copied() {
            return TypeId { index };
        }
        let index = u32::try_from(self.types.len()).unwrap();
        let ty = Rc::new(ty);
        self.type_to_index.insert(ty.clone(), index);
        self.types.push(ty);
        TypeId { index }
    }
pub fn insert ( & mut self , ty : Type < ' a > ) -> TypeId { if let Some ( index ) = self . type_to_index . get ( & ty ) . copied ( ) { return TypeId { index } ; } let index = u32 :: try_from ( self . types . len ( ) ) . unwrap ( ) ; let ty = Rc :: new ( ty ) ; self . type_to_index . insert ( ty . clone ( ) , index ) ; self . types . push ( ty ) ; TypeId { index } }
Insert a new type into this type set and get its id.
Insert a new type into this type set and get its id .
&mut self
ty
Type<'a>
&mut self
ty
Type<'a>