/// Given an enum variant's def, return the def of its enum and the associated fragment.
Given an enum variant's def, return the def of its enum and the associated fragment.
Given an enum variant ' s def return the def of its enum and the associated fragment .
fn handle_variant(cx: &DocContext, def: Def) -> Result<(Def, Option<String>), ()> {
    use rustc::ty::DefIdTree;
    let parent = if let Some(parent) = cx.tcx.parent(def.def_id()) {
        parent
    } else {
        return Err(())
    };
    let parent_def = Def::Enum(parent);
    let variant = cx.tcx.expect_variant_def(def);
    Ok((parent_def, Some(format!("{}.v", variant.name))))
}
fn handle_variant ( cx : & DocContext , def : Def ) -> Result < ( Def , Option < String > ) , ( ) > { use rustc :: ty :: DefIdTree ; let parent = if let Some ( parent ) = cx . tcx . parent ( def . def_id ( ) ) { parent } else { return Err ( ( ) ) } ; let parent_def = Def :: Enum ( parent ) ; let variant = cx . tcx . expect_variant_def ( def ) ; Ok ( ( parent_def , Some ( format ! ( " " variant name ) ) ) ) }
Given an enum variant's def, return the def of its enum and the associated fragment.
Given an enum variant ' s def return the def of its enum and the associated fragment .
cx
&DocContext
<not_specific>
def
Def
<not_specific>