Struct rustdoc::clean::types::Item

source ·
pub(crate) struct Item {
    pub(crate) name: Option<Symbol>,
    pub(crate) attrs: Box<Attributes>,
    pub(crate) kind: Box<ItemKind>,
    pub(crate) item_id: ItemId,
    pub(crate) inline_stmt_id: Option<DefId>,
    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.

§attrs: Box<Attributes>§kind: Box<ItemKind>

Information about this item that is specific to what kind of item it is. E.g., struct vs enum vs function.

§item_id: ItemId§inline_stmt_id: Option<DefId>

This is the DefId of the use statement if the item was inlined.

§cfg: Option<Arc<Cfg>>

Implementations§

source§

impl Item

source

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

source

pub(crate) fn const_stability<'tcx>( &self, tcx: TyCtxt<'tcx> ) -> 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: Box<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_trait(&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_type_alias(&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<'a> From<&'a Item> for ItemType

source§

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

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> 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<T> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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: 56 bytes