// Different kinds of items and item-like things:
/// An impl
Impl,
- /// A trait
- Trait(InternedString),
- /// An associated type **declaration** (i.e., in a trait)
- AssocTypeInTrait(InternedString),
- /// An associated type **value** (i.e., in an impl)
- AssocTypeInImpl(InternedString),
- /// An existential associated type **value** (i.e., in an impl)
- AssocExistentialInImpl(InternedString),
/// Something in the type NS
TypeNs(InternedString),
/// Something in the value NS
ValueNs(InternedString),
- /// A module declaration
- Module(InternedString),
/// A macro rule
MacroDef(InternedString),
/// A closure expression
ClosureExpr,
// Subportions of items
- /// A type (generic) parameter
- TypeParam(InternedString),
/// A lifetime (generic) parameter
LifetimeParam(InternedString),
/// A const (generic) parameter
ConstParam(InternedString),
- /// A variant of a enum
- EnumVariant(InternedString),
/// A struct field
Field(InternedString),
- /// Implicit ctor for a tuple-like struct
- StructCtor,
+ /// Implicit ctor for a unit or tuple-like struct or enum variant.
+ Ctor,
/// A constant expression (see {ast,hir}::AnonConst).
AnonConst,
/// An `impl Trait` type node
/// a whole crate (as opposed to just one item). GlobalMetaData components
/// are only supposed to show up right below the crate root.
GlobalMetaData(InternedString),
- /// A trait alias.
- TraitAlias(InternedString),
}
#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug,
use self::DefPathData::*;
match *self {
TypeNs(name) |
- Trait(name) |
- TraitAlias(name) |
- AssocTypeInTrait(name) |
- AssocTypeInImpl(name) |
- AssocExistentialInImpl(name) |
ValueNs(name) |
- Module(name) |
MacroDef(name) |
- TypeParam(name) |
LifetimeParam(name) |
ConstParam(name) |
- EnumVariant(name) |
Field(name) |
GlobalMetaData(name) => Some(name),
CrateRoot |
Misc |
ClosureExpr |
- StructCtor |
+ Ctor |
AnonConst |
ImplTrait => None
}
use self::DefPathData::*;
let s = match *self {
TypeNs(name) |
- Trait(name) |
- TraitAlias(name) |
- AssocTypeInTrait(name) |
- AssocTypeInImpl(name) |
- AssocExistentialInImpl(name) |
ValueNs(name) |
- Module(name) |
MacroDef(name) |
- TypeParam(name) |
LifetimeParam(name) |
ConstParam(name) |
- EnumVariant(name) |
Field(name) |
GlobalMetaData(name) => {
return name
Impl => "{{impl}}",
Misc => "{{misc}}",
ClosureExpr => "{{closure}}",
- StructCtor => "{{constructor}}",
+ Ctor => "{{constructor}}",
AnonConst => "{{constant}}",
ImplTrait => "{{opaque}}",
};