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

pub enum Def {
    DefFn(DefId, bool),
    DefSelfTy(Option<DefId>, Option<(NodeId, NodeId)>),
    DefMod(DefId),
    DefForeignMod(DefId),
    DefStatic(DefId, bool),
    DefConst(DefId),
    DefAssociatedConst(DefId, MethodProvenance),
    DefLocal(NodeId),
    DefVariant(DefId, DefId, bool),
    DefTy(DefId, bool),
    DefAssociatedTy(DefId, DefId),
    DefTrait(DefId),
    DefPrimTy(PrimTy),
    DefTyParam(ParamSpace, u32, DefId, Name),
    DefUse(DefId),
    DefUpvar(NodeId, NodeId),
    DefStruct(DefId),
    DefRegion(NodeId),
    DefLabel(NodeId),
    DefMethod(DefId, MethodProvenance),
}
Unstable

Variants

DefFn
Unstable
DefSelfTy
Unstable
DefMod
Unstable
DefForeignMod
Unstable
DefStatic
Unstable
DefConst
Unstable
DefAssociatedConst
Unstable
DefLocal
Unstable
DefVariant
Unstable
DefTy
Unstable
DefAssociatedTy
Unstable
DefTrait
Unstable
DefPrimTy
Unstable
DefTyParam
Unstable
DefUse
Unstable
DefUpvar
Unstable
DefStruct
Unstable

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.

DefRegion
Unstable
DefLabel
Unstable
DefMethod
Unstable

Methods

impl Def

fn local_node_id(&self) -> NodeId

Unstable

fn def_id(&self) -> DefId

Unstable

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

Unstable

Trait Implementations

impl<'tcx> Repr<'tcx> for Def

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

Derived Implementations

impl Debug for Def

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Hash for Def

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Decodable for Def

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

impl Encodable for Def

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

impl Eq for Def

impl PartialEq for Def

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

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

impl Copy for Def

impl Clone for Def

fn clone(&self) -> Def

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