pub enum FullDefKind<Body> {
Show 33 variants
Struct {
param_env: ParamEnv,
def: AdtDef,
drop_glue: Option<Body>,
},
Union {
param_env: ParamEnv,
def: AdtDef,
drop_glue: Option<Body>,
},
Enum {
param_env: ParamEnv,
def: AdtDef,
drop_glue: Option<Body>,
},
TyAlias {
param_env: ParamEnv,
ty: Option<Ty>,
},
ForeignTy,
AssocTy {
parent: DefId,
param_env: ParamEnv,
implied_predicates: GenericPredicates,
associated_item: AssocItem,
value: Option<Ty>,
},
OpaqueTy,
Trait {
param_env: ParamEnv,
implied_predicates: GenericPredicates,
self_predicate: TraitPredicate,
items: Vec<(AssocItem, Arc<FullDef<Body>>)>,
},
TraitAlias {
param_env: ParamEnv,
implied_predicates: GenericPredicates,
self_predicate: TraitPredicate,
},
TraitImpl {
param_env: ParamEnv,
trait_pred: TraitPredicate,
implied_impl_exprs: Vec<ImplExpr>,
items: Vec<ImplAssocItem<Body>>,
},
InherentImpl {
param_env: ParamEnv,
ty: Ty,
items: Vec<(AssocItem, Arc<FullDef<Body>>)>,
},
Fn {
param_env: ParamEnv,
inline: InlineAttr,
is_const: bool,
sig: PolyFnSig,
body: Option<Body>,
},
AssocFn {
parent: DefId,
param_env: ParamEnv,
associated_item: AssocItem,
inline: InlineAttr,
is_const: bool,
sig: PolyFnSig,
body: Option<Body>,
},
Closure {
parent: DefId,
is_const: bool,
args: ClosureArgs,
once_shim: Option<Body>,
drop_glue: Option<Body>,
},
Const {
param_env: ParamEnv,
ty: Ty,
body: Option<Body>,
},
AssocConst {
parent: DefId,
param_env: ParamEnv,
associated_item: AssocItem,
ty: Ty,
body: Option<Body>,
},
AnonConst {
param_env: ParamEnv,
ty: Ty,
body: Option<Body>,
},
InlineConst {
param_env: ParamEnv,
ty: Ty,
body: Option<Body>,
},
PromotedConst {
param_env: ParamEnv,
ty: Ty,
body: Body,
},
Static {
param_env: ParamEnv,
safety: Safety,
mutability: Mutability,
nested: bool,
ty: Ty,
body: Option<Body>,
},
ExternCrate,
Use,
Mod {
items: Vec<(Option<Ident>, DefId)>,
},
ForeignMod {
items: Vec<DefId>,
},
TyParam,
ConstParam,
LifetimeParam,
Variant,
Ctor {
adt_def_id: DefId,
ctor_of: CtorOf,
variant_id: VariantIdx,
fields: IndexVec<FieldIdx, FieldDef>,
output_ty: Ty,
},
Field,
Macro(MacroKind),
GlobalAsm,
SyntheticCoroutineBody,
}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§
Struct
Refers to the struct definition, DefKind::Ctor refers to its constructor if it exists.
Union
Enum
TyAlias
Type alias: type Foo = Bar;
ForeignTy
Type from an extern block.
AssocTy
Associated type: trait MyTrait { type Assoc; }
Fields
implied_predicates: GenericPredicatesOpaqueTy
Opaque type, aka impl Trait.
Trait
Fields
implied_predicates: GenericPredicatesself_predicate: TraitPredicateThe special Self: Trait clause.
TraitAlias
Trait alias: trait IntIterator = Iterator<Item = i32>;
Fields
implied_predicates: GenericPredicatesself_predicate: TraitPredicateThe special Self: Trait clause.
TraitImpl
Fields
trait_pred: TraitPredicateThe trait that is implemented by this impl block.
implied_impl_exprs: Vec<ImplExpr>The ImplExprs required to satisfy the predicates on the trait declaration. E.g.:
trait Foo: Bar {}
impl Foo for () {} // would supply an `ImplExpr` for `Self: Bar`.items: Vec<ImplAssocItem<Body>>Associated items, in the order of the trait declaration. Includes defaulted items.
InherentImpl
Fields
Fn
AssocFn
Associated function: impl MyStruct { fn associated() {} } or trait Foo { fn associated() {} }
Fields
inline: InlineAttrClosure
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: DefIdThe 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: ClosureArgsConst
AssocConst
Associated constant: trait MyTrait { const ASSOC: usize; }
AnonConst
Anonymous constant, e.g. the 1 + 2 in [u8; 1 + 2]
InlineConst
An inline constant, e.g. const { 1 + 2 }
PromotedConst
A promoted constant, e.g. &(1 + 2)
Static
Fields
mutability: MutabilityWhether it’s a static mut or just a static.
ExternCrate
Use
Mod
ForeignMod
An extern block.
TyParam
Type parameter: the T in struct Vec<T> { ... }
ConstParam
Constant generic parameter: struct Foo<const N: usize> { ... }
LifetimeParam
Lifetime parameter: the 'a in struct Foo<'a> { ... }
Variant
Refers to the variant definition, DefKind::Ctor refers to its constructor if it exists.
Ctor
The constructor function of a tuple/unit struct or tuple/unit enum variant.
Fields
variant_id: VariantIdxField
A field in a struct, enum or union. e.g.
barinstruct Foo { bar: u8 }Foo::Bar::0inenum Foo { Bar(u8) }
Macro(MacroKind)
Macros
GlobalAsm
A use of global_asm!.
SyntheticCoroutineBody
A synthetic coroutine body created by the lowering of a coroutine-closure, such as an async closure.
Trait Implementations§
Source§impl<Body: Clone> Clone for FullDefKind<Body>
impl<Body: Clone> Clone for FullDefKind<Body>
Source§fn clone(&self) -> FullDefKind<Body>
fn clone(&self) -> FullDefKind<Body>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Body: Debug> Debug for FullDefKind<Body>
impl<Body: Debug> Debug for FullDefKind<Body>
Source§impl<'de, Body> Deserialize<'de> for FullDefKind<Body>where
Body: Deserialize<'de>,
impl<'de, Body> Deserialize<'de> for FullDefKind<Body>where
Body: Deserialize<'de>,
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<Body: JsonSchema> JsonSchema for FullDefKind<Body>
impl<Body: JsonSchema> JsonSchema for FullDefKind<Body>
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, Body, S: UnderOwnerState<'tcx>> SInto<S, FullDefKind<Body>> for DefKindwhere
Body: IsBody + TypeMappable,
impl<'tcx, Body, S: UnderOwnerState<'tcx>> SInto<S, FullDefKind<Body>> for DefKindwhere
Body: IsBody + TypeMappable,
fn sinto(&self, s: &S) -> FullDefKind<Body>
Auto Trait Implementations§
impl<Body> Freeze for FullDefKind<Body>where
Body: Freeze,
impl<Body> RefUnwindSafe for FullDefKind<Body>where
Body: RefUnwindSafe,
impl<Body> Send for FullDefKind<Body>
impl<Body> Sync for FullDefKind<Body>
impl<Body> Unpin for FullDefKind<Body>where
Body: Unpin,
impl<Body> UnwindSafe for FullDefKind<Body>where
Body: UnwindSafe + RefUnwindSafe,
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§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