pub struct FullDef<'tcx> {
pub this: ItemRef<'tcx>,
pub span: Span,
pub source_span: Option<Span>,
pub attributes: &'tcx [Attribute],
pub visibility: Option<bool>,
pub lang_item: Option<Symbol>,
pub diagnostic_item: Option<Symbol>,
pub kind: FullDefKind<'tcx>,
}Expand description
Gathers a lot of definition information about a rustc_hir::def_id::DefId.
Fields§
§this: ItemRef<'tcx>A reference to the current item. If the item was provided with generic args, they are stored here; otherwise the args are the identity_args for this item.
span: SpanThe span of the definition of this item (e.g. for a function this is is signature).
source_span: Option<Span>The span of the whole definition (including e.g. the function body).
attributes: &'tcx [Attribute]Attributes on this definition, if applicable.
visibility: Option<bool>Visibility of the definition, for definitions where this makes sense.
lang_item: Option<Symbol>If this definition is a lang item, we store the identifier, e.g. sized.
diagnostic_item: Option<Symbol>If this definition is a diagnostic item, we store the identifier, e.g. box_new.
kind: FullDefKind<'tcx>Implementations§
Source§impl<'tcx> FullDef<'tcx>
impl<'tcx> FullDef<'tcx>
pub fn def_id(&self) -> &DefId
Sourcepub fn source_text(&self, tcx: TyCtxt<'tcx>) -> Option<String>
pub fn source_text(&self, tcx: TyCtxt<'tcx>) -> Option<String>
The text of the whole definition.
pub fn kind(&self) -> &FullDefKind<'tcx>
Sourcepub fn type_of<S: UnderOwnerState<'tcx>>(&self, s: &S) -> Option<Ty<'tcx>>
pub fn type_of<S: UnderOwnerState<'tcx>>(&self, s: &S) -> Option<Ty<'tcx>>
The type of this definition.
Sourcepub fn evaluate<S>(&self, s: &S, mode: ReadMode) -> Option<ConstantExpr<'tcx>>where
S: BaseState<'tcx>,
pub fn evaluate<S>(&self, s: &S, mode: ReadMode) -> Option<ConstantExpr<'tcx>>where
S: BaseState<'tcx>,
Evaluate the value of a Const, AssocConst or Static item. Returns None for other
items, or if the item can’t be evaluated (see read_const).
Sourcepub fn associated_item(&self) -> Option<&AssocItem<'tcx>>
pub fn associated_item(&self) -> Option<&AssocItem<'tcx>>
Associated-item metadata for methods, associated constants, and associated types.
Sourcepub fn param_env(&self) -> Option<&ParamEnv<'tcx>>
pub fn param_env(&self) -> Option<&ParamEnv<'tcx>>
Returns the generics and predicates for definitions that have those.
Sourcepub fn has_any_generics(&self) -> bool
pub fn has_any_generics(&self) -> bool
Whether the item has any generics at all (including parent generics).
Sourcepub fn has_own_generics(&self) -> bool
pub fn has_own_generics(&self) -> bool
Whether the item has any generics of its own (ignoring parent generics).
Sourcepub fn has_own_generics_or_predicates(&self) -> bool
pub fn has_own_generics_or_predicates(&self) -> bool
Whether the item has any generics or predicates of its own (ignoring parent generics/predicates).
Trait Implementations§
Auto Trait Implementations§
impl<'tcx> !DynSync for FullDef<'tcx>
impl<'tcx> !Freeze for FullDef<'tcx>
impl<'tcx> !RefUnwindSafe for FullDef<'tcx>
impl<'tcx> !Sync for FullDef<'tcx>
impl<'tcx> !UnwindSafe for FullDef<'tcx>
impl<'tcx> DynSend for FullDef<'tcx>
impl<'tcx> Forget for FullDef<'tcx>
impl<'tcx> Move for FullDef<'tcx>
impl<'tcx> Send for FullDef<'tcx>
impl<'tcx> Unpin for FullDef<'tcx>
impl<'tcx> UnsafeUnpin for FullDef<'tcx>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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