Struct rustdoc::clean::types::Item [−][src]
pub(crate) struct Item {
pub(crate) name: Option<Symbol>,
pub(crate) attrs: Box<Attributes>,
pub(crate) visibility: Visibility,
pub(crate) kind: Box<ItemKind>,
pub(crate) def_id: ItemId,
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>
visibility: Visibility
kind: Box<ItemKind>
Information about this item that is specific to what kind of item it is. E.g., struct vs enum vs function.
def_id: ItemId
cfg: Option<Arc<Cfg>>
Implementations
Finds the doc
attribute as a NameValue and returns the corresponding
value found.
pub fn from_hir_id_and_parts(
hir_id: HirId,
name: Option<Symbol>,
kind: ItemKind,
cx: &mut DocContext<'_>
) -> Item
pub fn from_hir_id_and_parts(
hir_id: HirId,
name: Option<Symbol>,
kind: ItemKind,
cx: &mut DocContext<'_>
) -> Item
Convenience wrapper around Self::from_def_id_and_parts
which converts
hir_id
to a DefId
pub fn from_def_id_and_parts(
def_id: DefId,
name: Option<Symbol>,
kind: ItemKind,
cx: &mut DocContext<'_>
) -> Item
pub fn from_def_id_and_attrs_and_parts(
def_id: DefId,
name: Option<Symbol>,
kind: ItemKind,
attrs: Box<Attributes>,
cx: &mut DocContext<'_>,
cfg: Option<Arc<Cfg>>
) -> Item
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.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Item
impl !UnwindSafe for Item
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
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