Item in rustc_ast::ast - Rust (original) (raw)

pub struct Item<K = ItemKind> {
    pub attrs: AttrVec,
    pub id: NodeId,
    pub span: Span,
    pub vis: Visibility,
    pub kind: K,
    pub tokens: Option<LazyAttrTokenStream>,
}

Expand description

An item definition.

Original tokens this item was parsed from. This isn’t necessarily available for all items, although over time more and more items should have this be Some. Right now this is primarily used for procedural macros, notably custom attributes.

Note that the tokens here do not include the outer attributes, but will include inner attributes.

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.