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
impl Item
pub(crate) fn stability<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Option<Stability>
pub(crate) fn const_stability<'tcx>(
&self,
tcx: TyCtxt<'tcx>
) -> Option<ConstStability>
pub(crate) fn deprecation(&self, tcx: TyCtxt<'_>) -> Option<Deprecation>
pub(crate) fn inner_docs(&self, tcx: TyCtxt<'_>) -> bool
pub(crate) fn span(&self, tcx: TyCtxt<'_>) -> Option<Span>
pub(crate) fn attr_span(&self, tcx: TyCtxt<'_>) -> Span
sourcepub(crate) fn doc_value(&self) -> Option<String>
pub(crate) fn doc_value(&self) -> Option<String>
Finds the doc
attribute as a NameValue and returns the corresponding
value found.
sourcepub(crate) fn from_hir_id_and_parts(
hir_id: HirId,
name: Option<Symbol>,
kind: ItemKind,
cx: &mut DocContext<'_>
) -> Item
pub(crate) 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(crate) fn from_def_id_and_parts(
def_id: DefId,
name: Option<Symbol>,
kind: ItemKind,
cx: &mut DocContext<'_>
) -> Item
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
sourcepub(crate) fn collapsed_doc_value(&self) -> Option<String>
pub(crate) fn collapsed_doc_value(&self) -> Option<String>
Finds all doc
attributes as NameValues and returns their corresponding values, joined
with newlines.
pub(crate) fn links(&self, cx: &Context<'_>) -> Vec<RenderedLink> ⓘ
sourcepub(crate) fn link_names(&self, cache: &Cache) -> Vec<RenderedLink> ⓘ
pub(crate) fn link_names(&self, cache: &Cache) -> Vec<RenderedLink> ⓘ
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.
pub(crate) fn is_crate(&self) -> bool
pub(crate) fn is_mod(&self) -> bool
pub(crate) fn is_trait(&self) -> bool
pub(crate) fn is_struct(&self) -> bool
pub(crate) fn is_enum(&self) -> bool
pub(crate) fn is_variant(&self) -> bool
pub(crate) fn is_associated_type(&self) -> bool
pub(crate) fn is_ty_associated_type(&self) -> bool
pub(crate) fn is_associated_const(&self) -> bool
pub(crate) fn is_ty_associated_const(&self) -> bool
pub(crate) fn is_method(&self) -> bool
pub(crate) fn is_ty_method(&self) -> bool
pub(crate) fn is_typedef(&self) -> bool
pub(crate) fn is_primitive(&self) -> bool
pub(crate) fn is_union(&self) -> bool
pub(crate) fn is_import(&self) -> bool
pub(crate) fn is_extern_crate(&self) -> bool
pub(crate) fn is_keyword(&self) -> bool
pub(crate) fn is_stripped(&self) -> bool
pub(crate) fn has_stripped_entries(&self) -> Option<bool>
pub(crate) fn stability_class(&self, tcx: TyCtxt<'_>) -> Option<String>
pub(crate) fn stable_since(&self, tcx: TyCtxt<'_>) -> Option<Symbol>
pub(crate) fn const_stable_since(&self, tcx: TyCtxt<'_>) -> Option<Symbol>
pub(crate) fn is_non_exhaustive(&self) -> bool
pub(crate) fn is_default(&self) -> bool
sourcepub(crate) fn fn_header(&self, tcx: TyCtxt<'_>) -> Option<FnHeader>
pub(crate) fn fn_header(&self, tcx: TyCtxt<'_>) -> Option<FnHeader>
Returns a FnHeader
if self
is a function item, otherwise returns None
.
sourcepub(crate) fn visibility(&self, tcx: TyCtxt<'_>) -> Option<Visibility<DefId>>
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.
Trait Implementations§
Auto Trait Implementations§
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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