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§

Finds the doc attribute as a NameValue and returns the corresponding value found.

Convenience wrapper around Self::from_def_id_and_parts which converts hir_id to a DefId

Finds all doc attributes as NameValues and returns their corresponding values, joined with newlines.

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.

Returns a documentation-level item type from the item.

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

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

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

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 {:?}.

Formats the value using the given formatter. Read more
Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
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