Skip to main content

FullDef

Struct FullDef 

Source
pub struct FullDef {
    pub this: ItemRef,
    pub span: Span,
    pub source_span: Option<Span>,
    pub source_text: Option<String>,
    pub attributes: Vec<Attribute>,
    pub visibility: Option<bool>,
    pub lang_item: Option<Symbol>,
    pub diagnostic_item: Option<Symbol>,
    pub kind: FullDefKind,
}
Expand description

Gathers a lot of definition information about a rustc_hir::def_id::DefId.

Fields§

§this: ItemRef

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: Span

The 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).

§source_text: Option<String>

The text of the whole definition.

§attributes: Vec<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

Implementations§

Source§

impl FullDef

Source

pub fn def_id(&self) -> &DefId

Source

pub fn this(&self) -> &ItemRef

Reference to the item itself.

Source

pub fn kind(&self) -> &FullDefKind

Source

pub fn param_env(&self) -> Option<&ParamEnv>

Returns the generics and predicates for definitions that have those.

Source

pub fn typing_parent<'tcx>(&self, s: &impl BaseState<'tcx>) -> Option<ItemRef>

Return the parent of this item if the item inherits the typing context from its parent.

Source

pub fn has_any_generics(&self) -> bool

Whether the item has any generics at all (including parent generics).

Source

pub fn has_own_generics(&self) -> bool

Whether the item has any generics of its own (ignoring parent generics).

Source

pub fn has_own_generics_or_predicates(&self) -> bool

Whether the item has any generics or predicates of its own (ignoring parent generics/predicates).

Source

pub fn nameable_children<'tcx>( &self, s: &impl BaseState<'tcx>, ) -> Vec<(Symbol, DefId)>

Lists the children of this item that can be named, in the way of normal rust paths. For types, this includes inherent items.

Trait Implementations§

Source§

impl Clone for FullDef

Source§

fn clone(&self) -> FullDef

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FullDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<I, T> ExtractContext<I, ()> for T

§

fn extract_context(self, _original_input: I)

Given the context attached to a nom error, and given the original input to the nom parser, extract more the useful context information. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<I> RecreateContext<I> for I

§

fn recreate_context(_original_input: I, tail: I) -> I

Given the original input, as well as the context reported by nom, recreate a context in the original string where the error occurred. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more