pub fn trait_of_method(tcx: ctxt, def_id: ast::DefId)
                       -> Option<ast::DefId> {
    match tcx.methods.find(&def_id) {
        Some(method_descriptor) => {
            match method_descriptor.container {
                TraitContainer(id) => return Some(id),
                _ => {}
            }
        }
        None => {}
    }

    // If the method was in the local crate, then if we got here we know the
    // answer is negative.
    if def_id.crate == LOCAL_CRATE {
        return None
    }

    let result = csearch::get_trait_of_method(tcx.cstore, def_id, tcx);

    result
}
/// If the given def ID describes a trait method, returns the ID of the trait
/// that the method belongs to. Otherwise, returns `None`.
If the given def ID describes a trait method, returns the ID of the trait
that the method belongs to. Otherwise, returns `None`.
If the given def ID describes a trait method returns the ID of the trait that the method belongs to . Otherwise returns ` None ` .
pub fn trait_of_method(tcx: ctxt, def_id: ast::DefId)
                       -> Option<ast::DefId> {
    match tcx.methods.find(&def_id) {
        Some(method_descriptor) => {
            match method_descriptor.container {
                TraitContainer(id) => return Some(id),
                _ => {}
            }
        }
        None => {}
    }
    // If the method was in the local crate, then if we got here we know the
    // answer is negative.
    if def_id.crate == LOCAL_CRATE {
        return None
    }
    let result = csearch::get_trait_of_method(tcx.cstore, def_id, tcx);
    result
}
pub fn trait_of_method ( tcx : ctxt , def_id : ast :: DefId ) -> Option < ast :: DefId > { match tcx . methods . find ( & def_id ) { Some ( method_descriptor ) => { match method_descriptor . container { TraitContainer ( id ) => return Some ( id ) , _ => { } } } None => { } } // If the method was in the local crate, then if we got here we know the // answer is negative. if def_id . crate == LOCAL_CRATE { return None } let result = csearch :: get_trait_of_method ( tcx . cstore , def_id , tcx ) ; result }
If the given def ID describes a trait method, returns the ID of the trait
that the method belongs to.
If the given def ID describes a trait method returns the ID of the trait that the method belongs to .
tcx
ctxt
def_id
ast::DefId
tcx
ctxt
def_id
ast::DefId