pub fn is_foreign_contract(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
    if let Some(DisambiguatedDefPathData {
        data: DefPathData::TypeNs(name),
        ..
    }) = &tcx.def_path(def_id).data.first()
    {
        name.as_str() == "foreign_contracts"
    } else {
        false
    }
}
/// Returns true if the first component is a module named "foreign_contracts".
Returns true if the first component is a module named "foreign_contracts".
Returns true if the first component is a module named " foreign_contracts " .
pub fn is_foreign_contract(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
    if let Some(DisambiguatedDefPathData {
        data: DefPathData::TypeNs(name),
        ..
    }) = &tcx.def_path(def_id).data.first()
    {
        name.as_str() == "foreign_contracts"
    } else {
        false
    }
}
pub fn is_foreign_contract ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> bool { if let Some ( DisambiguatedDefPathData { data : DefPathData :: TypeNs ( name ) , .. } ) = & tcx . def_path ( def_id ) . data . first ( ) { name . as_str ( ) == " " } else { false } }
Returns true if the first component is a module named "foreign_contracts".
Returns true if the first component is a module named " foreign_contracts " .
tcx
TyCtxt<'_>
def_id
DefId