Enum rustc::middle::def::Def[src]

pub enum Def {
    DefFn(DefId, FnStyle),
    DefStaticMethod(DefId, MethodProvenance, FnStyle),
    DefSelfTy(NodeId),
    DefMod(DefId),
    DefForeignMod(DefId),
    DefStatic(DefId, bool),
    DefArg(NodeId, BindingMode),
    DefLocal(NodeId, BindingMode),
    DefVariant(DefId, DefId, bool),
    DefTy(DefId),
    DefTrait(DefId),
    DefPrimTy(PrimTy),
    DefTyParam(ParamSpace, DefId, uint),
    DefBinding(NodeId, BindingMode),
    DefUse(DefId),
    DefUpvar(NodeId, Gc<Def>, NodeId, NodeId),
    DefStruct(DefId),
    DefTyParamBinder(NodeId),
    DefRegion(NodeId),
    DefLabel(NodeId),
    DefMethod(DefId, Option<DefId>),
}

Variants

DefFn
DefStaticMethod
DefSelfTy
DefMod
DefForeignMod
DefStatic
DefArg
DefLocal
DefVariant
DefTy
DefTrait
DefPrimTy
DefTyParam
DefBinding
DefUse
DefUpvar
DefStruct

Note that if it's a tuple struct's definition, the node id of the ast::DefId may either refer to the item definition's id or the StructDef.ctor_id.

The cases that I have encountered so far are (this is not exhaustive): - If it's a ty_path referring to some tuple struct, then DefMap maps it to a def whose id is the item definition's id. - If it's an ExprPath referring to some tuple struct, then DefMap maps it to a def whose id is the StructDef.ctor_id.

DefTyParamBinder
DefRegion
DefLabel
DefMethod

Methods

impl Def

fn def_id(&self) -> DefId

fn variant_def_ids(&self) -> Option<(DefId, DefId)>

Trait Implementations

impl tr for Def

fn tr(&self, xcx: &ExtendedDecodeContext) -> Def

impl Repr for Def

fn repr(&self, _tcx: &ctxt) -> String

Derived Implementations

impl<__S: Writer> Hash<__S> for Def

fn hash(&self, __arg_0: &mut __S)

impl<__D: Decoder<__E>, __E> Decodable<__D, __E> for Def

fn decode(__arg_0: &mut __D) -> Result<Def, __E>

impl<__S: Encoder<__E>, __E> Encodable<__S, __E> for Def

fn encode(&self, __arg_0: &mut __S) -> Result<(), __E>

impl Eq for Def

fn assert_receiver_is_total_eq(&self)

impl PartialEq for Def

fn eq(&self, __arg_0: &Def) -> bool

fn ne(&self, __arg_0: &Def) -> bool

impl Clone for Def

fn clone(&self) -> Def

fn clone_from(&mut self, source: &Self)