rustdoc::clean::types

Struct Item

Source
pub(crate) struct Item {
    pub(crate) name: Option<Symbol>,
    pub(crate) inner: Box<ItemInner>,
    pub(crate) item_id: ItemId,
    pub(crate) inline_stmt_id: Option<LocalDefId>,
    pub(crate) cfg: Option<Arc<Cfg>>,
}
Expand description

Anything with a source location and set of attributes and, optionally, a name. That is, anything that can be documented. This doesn’t correspond directly to the AST’s concept of an item; it’s a strict superset.

Fields§

§name: Option<Symbol>

The name of this item. Optional because not every item has a name, e.g. impls.

§inner: Box<ItemInner>§item_id: ItemId§inline_stmt_id: Option<LocalDefId>

This is the LocalDefId of the use statement if the item was inlined. The crate metadata doesn’t hold this information, so the use statement always belongs to the current crate.

§cfg: Option<Arc<Cfg>>

Implementations§

Source§

impl Item

Source

pub(crate) fn stability(&self, tcx: TyCtxt<'_>) -> Option<Stability>

Returns the effective stability of the item.

This method should only be called after the propagate-stability pass has been run.

Source

pub(crate) fn const_stability(&self, tcx: TyCtxt<'_>) -> Option<ConstStability>

Source

pub(crate) fn deprecation(&self, tcx: TyCtxt<'_>) -> Option<Deprecation>

Source

pub(crate) fn inner_docs(&self, tcx: TyCtxt<'_>) -> bool

Source

pub(crate) fn span(&self, tcx: TyCtxt<'_>) -> Option<Span>

Source

pub(crate) fn attr_span(&self, tcx: TyCtxt<'_>) -> Span

Source

pub(crate) fn doc_value(&self) -> String

Combine all doc strings into a single value handling indentation and newlines as needed.

Source

pub(crate) fn opt_doc_value(&self) -> Option<String>

Combine all doc strings into a single value handling indentation and newlines as needed. Returns None is there’s no documentation at all, and Some("") if there is some documentation but it is empty (e.g. #[doc = ""]).

Source

pub(crate) fn from_def_id_and_parts( def_id: DefId, name: Option<Symbol>, kind: ItemKind, cx: &mut DocContext<'_>, ) -> Item

Source

pub(crate) fn from_def_id_and_attrs_and_parts( def_id: DefId, name: Option<Symbol>, kind: ItemKind, attrs: Attributes, cfg: Option<Arc<Cfg>>, ) -> Item

Find a list of all link names, without finding their href.

This is used for generating summary text, which does not include the link text, but does need to know which []-bracketed names are actually links.

Source

pub(crate) fn is_crate(&self) -> bool

Source

pub(crate) fn is_mod(&self) -> bool

Source

pub(crate) fn is_struct(&self) -> bool

Source

pub(crate) fn is_enum(&self) -> bool

Source

pub(crate) fn is_variant(&self) -> bool

Source

pub(crate) fn is_associated_type(&self) -> bool

Source

pub(crate) fn is_ty_associated_type(&self) -> bool

Source

pub(crate) fn is_associated_const(&self) -> bool

Source

pub(crate) fn is_ty_associated_const(&self) -> bool

Source

pub(crate) fn is_method(&self) -> bool

Source

pub(crate) fn is_ty_method(&self) -> bool

Source

pub(crate) fn is_primitive(&self) -> bool

Source

pub(crate) fn is_union(&self) -> bool

Source

pub(crate) fn is_import(&self) -> bool

Source

pub(crate) fn is_extern_crate(&self) -> bool

Source

pub(crate) fn is_keyword(&self) -> bool

Source

pub(crate) fn is_stripped(&self) -> bool

Source

pub(crate) fn has_stripped_entries(&self) -> Option<bool>

Source

pub(crate) fn stability_class(&self, tcx: TyCtxt<'_>) -> Option<String>

Source

pub(crate) fn stable_since(&self, tcx: TyCtxt<'_>) -> Option<StableSince>

Source

pub(crate) fn is_non_exhaustive(&self) -> bool

Source

pub(crate) fn type_(&self) -> ItemType

Returns a documentation-level item type from the item.

Source

pub(crate) fn is_default(&self) -> bool

Source

pub(crate) fn fn_header(&self, tcx: TyCtxt<'_>) -> Option<FnHeader>

Returns a FnHeader if self is a function item, otherwise returns None.

Source

pub(crate) fn visibility(&self, tcx: TyCtxt<'_>) -> Option<Visibility<DefId>>

Returns the visibility of the current item. If the visibility is “inherited”, then None is returned.

Source

pub(crate) fn attributes( &self, tcx: TyCtxt<'_>, cache: &Cache, keep_as_is: bool, ) -> Vec<String>

Source

pub fn is_doc_hidden(&self) -> bool

Source

pub fn def_id(&self) -> Option<DefId>

Trait Implementations§

Source§

impl Clone for Item

Source§

fn clone(&self) -> Item

Returns a copy 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 Item

NOTE: this does NOT unconditionally print every item, to avoid thousands of lines of logs. If you want to see the debug output for attributes and the kind as well, use {:#?} instead of {:?}.

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Deref for Item

Source§

type Target = ItemInner

The resulting type after dereferencing.
Source§

fn deref(&self) -> &ItemInner

Dereferences the value.
Source§

impl<'a> From<&'a Item> for ItemType

Source§

fn from(item: &'a Item) -> ItemType

Converts to this type from the input type.
Source§

impl<'a> From<&'a Item> for ModuleLike

Source§

fn from(it: &'a Item) -> ModuleLike

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Item

§

impl !RefUnwindSafe for Item

§

impl !Send for Item

§

impl !Sync for Item

§

impl Unpin for Item

§

impl !UnwindSafe for Item

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, dst: *mut T)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 48 bytes