pub enum FullDefKind {
Show 30 variants
Mod,
Struct {
generics: TyGenerics,
predicates: GenericPredicates,
def: AdtDef,
},
Union {
generics: TyGenerics,
predicates: GenericPredicates,
def: AdtDef,
},
Enum {
generics: TyGenerics,
predicates: GenericPredicates,
def: AdtDef,
},
Variant,
Trait {
generics: TyGenerics,
predicates: GenericPredicates,
self_predicate: TraitPredicate,
items: Vec<AssocItem>,
},
TyAlias {
generics: TyGenerics,
predicates: GenericPredicates,
ty: Option<Ty>,
},
ForeignTy,
TraitAlias,
AssocTy {
parent: DefId,
generics: TyGenerics,
predicates: GenericPredicates,
associated_item: AssocItem,
value: Option<Ty>,
},
TyParam,
Fn {
generics: TyGenerics,
predicates: GenericPredicates,
inline: InlineAttr,
sig: PolyFnSig,
},
AssocFn {
parent: DefId,
associated_item: AssocItem,
generics: TyGenerics,
predicates: GenericPredicates,
inline: InlineAttr,
sig: PolyFnSig,
},
Closure {
parent: DefId,
args: ClosureArgs,
},
Const {
generics: TyGenerics,
predicates: GenericPredicates,
ty: Ty,
},
AssocConst {
parent: DefId,
associated_item: AssocItem,
generics: TyGenerics,
predicates: GenericPredicates,
ty: Ty,
},
Static {
safety: Safety,
mutability: Mutability,
nested: bool,
generics: TyGenerics,
predicates: GenericPredicates,
ty: Ty,
},
ConstParam,
Ctor(CtorOf, CtorKind),
Macro(MacroKind),
ExternCrate,
Use,
ForeignMod,
AnonConst,
InlineConst,
OpaqueTy,
Impl {
generics: TyGenerics,
predicates: GenericPredicates,
impl_subject: ImplSubject,
items: Vec<AssocItem>,
},
Field,
LifetimeParam,
GlobalAsm,
}
Expand description
Imbues [rustc_hir::def::DefKind
] with a lot of extra information.
Important: the owner_id()
must be the id of this definition.
Variants§
Mod
Struct
Refers to the struct definition, [DefKind::Ctor
] refers to its constructor if it exists.
Union
Enum
Variant
Refers to the variant definition, [DefKind::Ctor
] refers to its constructor if it exists.
Trait
TyAlias
Type alias: type Foo = Bar;
ForeignTy
Type from an extern
block.
TraitAlias
Trait alias: trait IntIterator = Iterator<Item = i32>;
AssocTy
Associated type: trait MyTrait { type Assoc; }
TyParam
Type parameter: the T
in struct Vec<T> { ... }
Fn
AssocFn
Associated function: impl MyStruct { fn associated() {} }
or trait Foo { fn associated() {} }
Closure
A closure, coroutine, or coroutine-closure.
Note: the (early-bound) generics of a closure are the same as those of the item in which it is defined.
Fields
parent: DefId
The enclosing item. Note: this item could itself be a closure; to get the generics, you might have to recurse through several layers of parents until you find a function or constant.
args: ClosureArgs
Const
AssocConst
Associated constant: trait MyTrait { const ASSOC: usize; }
Static
Fields
mutability: Mutability
Whether it’s a static mut
or just a static
.
generics: TyGenerics
predicates: GenericPredicates
ConstParam
Constant generic parameter: struct Foo<const N: usize> { ... }
Ctor(CtorOf, CtorKind)
Refers to the struct or enum variant’s constructor.
Macro(MacroKind)
ExternCrate
Use
ForeignMod
An extern
block.
AnonConst
Anonymous constant, e.g. the 1 + 2
in [u8; 1 + 2]
InlineConst
An inline constant, e.g. const { 1 + 2 }
OpaqueTy
Opaque type, aka impl Trait
.
Impl
Field
A field in a struct, enum or union. e.g.
bar
instruct Foo { bar: u8 }
Foo::Bar::0
inenum Foo { Bar(u8) }
LifetimeParam
Lifetime parameter: the 'a
in struct Foo<'a> { ... }
GlobalAsm
A use of global_asm!
.
Trait Implementations§
source§impl<'__de> BorrowDecode<'__de> for FullDefKind
impl<'__de> BorrowDecode<'__de> for FullDefKind
source§fn borrow_decode<__D: BorrowDecoder<'__de>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
source§impl Clone for FullDefKind
impl Clone for FullDefKind
source§fn clone(&self) -> FullDefKind
fn clone(&self) -> FullDefKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FullDefKind
impl Debug for FullDefKind
source§impl Decode for FullDefKind
impl Decode for FullDefKind
source§impl<'de> Deserialize<'de> for FullDefKind
impl<'de> Deserialize<'de> for FullDefKind
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Encode for FullDefKind
impl Encode for FullDefKind
source§impl JsonSchema for FullDefKind
impl JsonSchema for FullDefKind
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, FullDefKind> for DefKind
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, FullDefKind> for DefKind
fn sinto(&self, s: &S) -> FullDefKind
Auto Trait Implementations§
impl Freeze for FullDefKind
impl RefUnwindSafe for FullDefKind
impl Send for FullDefKind
impl Sync for FullDefKind
impl Unpin for FullDefKind
impl UnwindSafe for FullDefKind
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more