/// If the given def ID describes an item belonging to a trait (either a
/// default method or an implementation of a trait method), return the ID of
/// the trait that the method belongs to. Otherwise, return `None`.
If the given def ID describes an item belonging to a trait (either a
default method or an implementation of a trait method), return the ID of
the trait that the method belongs to. Otherwise, return `None`.
If the given def ID describes an item belonging to a trait ( either a default method or an implementation of a trait method ) return the ID of the trait that the method belongs to . Otherwise return ` None ` .
pub fn trait_of_item(&self, def_id: DefId) -> Option<DefId> {
        if def_id.krate != LOCAL_CRATE {
            return csearch::get_trait_of_item(&self.sess.cstore, def_id, self);
        }
        match self.impl_or_trait_items.borrow().get(&def_id).cloned() {
            Some(impl_or_trait_item) => {
                match impl_or_trait_item.container() {
                    TraitContainer(def_id) => Some(def_id),
                    ImplContainer(def_id) => self.trait_id_of_impl(def_id),
                }
            }
            None => None
        }
    }
pub fn trait_of_item ( & self , def_id : DefId ) -> Option < DefId > { if def_id . krate != LOCAL_CRATE { return csearch :: get_trait_of_item ( & self . sess . cstore , def_id , self ) ; } match self . impl_or_trait_items . borrow ( ) . get ( & def_id ) . cloned ( ) { Some ( impl_or_trait_item ) => { match impl_or_trait_item . container ( ) { TraitContainer ( def_id ) => Some ( def_id ) , ImplContainer ( def_id ) => self . trait_id_of_impl ( def_id ) , } } None => None } }
If the given def ID describes an item belonging to a trait (either a
default method or an implementation of a trait method), return the ID of
the trait that the method belongs to.
If the given def ID describes an item belonging to a trait ( either a default method or an implementation of a trait method ) return the ID of the trait that the method belongs to .
&self
def_id
DefId