pub fn trait_of_method(tcx: ctxt, def_id: ast::DefId)
                       -> Option<ast::DefId> {
    if def_id.crate != LOCAL_CRATE {
        return csearch::get_trait_of_method(tcx.cstore, def_id, tcx);
    }
    let method;
    {
        let methods = tcx.methods.borrow();
        method = methods.get().find(&def_id).map(|method| *method);
    }
    match method {
        Some(method) => {
            match method.container {
                TraitContainer(def_id) => Some(def_id),
                ImplContainer(def_id) => trait_id_of_impl(tcx, def_id),
            }
        }
        None => None
    }
}
/// If the given def ID describes a method 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 a method 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 a method 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_method(tcx: ctxt, def_id: ast::DefId)
                       -> Option<ast::DefId> {
    if def_id.crate != LOCAL_CRATE {
        return csearch::get_trait_of_method(tcx.cstore, def_id, tcx);
    }
    let method;
    {
        let methods = tcx.methods.borrow();
        method = methods.get().find(&def_id).map(|method| *method);
    }
    match method {
        Some(method) => {
            match method.container {
                TraitContainer(def_id) => Some(def_id),
                ImplContainer(def_id) => trait_id_of_impl(tcx, def_id),
            }
        }
        None => None
    }
}
pub fn trait_of_method ( tcx : ctxt , def_id : ast :: DefId ) -> Option < ast :: DefId > { if def_id . crate != LOCAL_CRATE { return csearch :: get_trait_of_method ( tcx . cstore , def_id , tcx ) ; } let method ; { let methods = tcx . methods . borrow ( ) ; method = methods . get ( ) . find ( & def_id ) . map ( | method | * method ) ; } match method { Some ( method ) => { match method . container { TraitContainer ( def_id ) => Some ( def_id ) , ImplContainer ( def_id ) => trait_id_of_impl ( tcx , def_id ) , } } None => None } }
If the given def ID describes a method 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 a method 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 .
tcx
ctxt
def_id
ast::DefId
tcx
ctxt
def_id
ast::DefId