Enum rustc_hir::def::DefKind [−][src]
pub enum DefKind {
Show variants
Mod,
Struct,
Union,
Enum,
Variant,
Trait,
TyAlias,
ForeignTy,
TraitAlias,
AssocTy,
TyParam,
Fn,
Const,
ConstParam,
Static,
Ctor(CtorOf, CtorKind),
AssocFn,
AssocConst,
Macro(MacroKind),
ExternCrate,
Use,
ForeignMod,
AnonConst,
OpaqueTy,
Field,
LifetimeParam,
GlobalAsm,
Impl,
Closure,
Generator,
}Expand description
What kind of definition something is; e.g., mod vs struct.
Variants
Expand description
Refers to the struct itself, DefKind::Ctor refers to its constructor if it exists.
Expand description
Refers to the variant itself, DefKind::Ctor refers to its constructor if it exists.
Expand description
Type alias: type Foo = Bar;
Expand description
Type from an extern block.
Expand description
Trait alias: trait IntIterator = Iterator<Item = i32>;
Expand description
Associated type: trait MyTrait { type Assoc; }
Expand description
Type parameter: the T in struct Vec<T> { ... }
Expand description
Constant generic parameter: struct Foo<const N: usize> { ... }
Expand description
Refers to the struct or enum variant’s constructor.
The reason Ctor exists in addition to DefKind::Struct and
DefKind::Variant is because structs and enum variants exist
in the type namespace, whereas struct and enum variant constructors
exist in the value namespace.
You may wonder why enum variants exist in the type namespace as opposed to the value namespace. Check out RFC 2593 for intuition on why that is.
Expand description
Associated function: impl MyStruct { fn associated() {} }
Expand description
Associated constant: trait MyTrait { const ASSOC: usize; }
Macro(MacroKind)Expand description
An extern block.
Expand description
Anonymous constant, e.g. the 1 + 2 in [u8; 1 + 2], or const { 1 + 2}
Expand description
Opaque type, aka impl Trait.
Expand description
Lifetime parameter: the 'a in struct Foo<'a> { ... }
Expand description
A use of global_asm!.
Implementations
impl DefKind[src]
impl DefKind[src]Trait Implementations
impl<__CTX> HashStable<__CTX> for DefKind where
__CTX: HashStableContext, [src]
impl<__CTX> HashStable<__CTX> for DefKind where
__CTX: HashStableContext, [src]fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)[src]
impl Copy for DefKind[src]
impl Eq for DefKind[src]
impl StructuralEq for DefKind[src]
impl StructuralPartialEq for DefKind[src]
Auto Trait Implementations
impl RefUnwindSafe for DefKind
impl Send for DefKind
impl Sync for DefKind
impl Unpin for DefKind
impl UnwindSafe for DefKind
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more