Trait ItemData

Source
pub trait ItemData<'ast>:
    Debug
    + EmissionNode<'ast>
    + HasSpan<'ast>
    + HasNodeId
    + Sealed {
    // Required methods
    fn id(&self) -> ItemId;
    fn visibility(&self) -> &Visibility<'ast>;
    fn ident(&self) -> Option<&Ident<'ast>>;
    fn as_item(&'ast self) -> ItemKind<'ast>;
    fn attrs(&self);
}
Expand description

This trait combines methods, which are common between all items.

This trait is only meant to be implemented inside this crate. The Sealed super trait prevents external implementations.

Required Methods§

Source

fn id(&self) -> ItemId

Returns the ItemId of this item. This is a unique identifier used for comparison and to request items from the MarkerContext.

Source

fn visibility(&self) -> &Visibility<'ast>

The Visibility of this item.

Source

fn ident(&self) -> Option<&Ident<'ast>>

This function can return None if the item was generated and has no real name

Source

fn as_item(&'ast self) -> ItemKind<'ast>

Returns this item wrapped in it’s ExprKind variant.

In function parameters, it’s recommended to use Into<ItemKind<'ast>> as a bound to support all items and ItemKind<'ast> as parameters.

Source

fn attrs(&self)

The attributes attached to this item.

Currently, it’s only a placeholder until a proper representation is implemented. rust-marker/marker#51 tracks the task of implementing this. You’re welcome to leave any comments in that issue.

Implementors§

Source§

impl<'ast> ItemData<'ast> for ConstItem<'ast>

Source§

impl<'ast> ItemData<'ast> for EnumItem<'ast>

Source§

impl<'ast> ItemData<'ast> for ExternBlockItem<'ast>

Source§

impl<'ast> ItemData<'ast> for ExternCrateItem<'ast>

Source§

impl<'ast> ItemData<'ast> for FnItem<'ast>

Source§

impl<'ast> ItemData<'ast> for ImplItem<'ast>

Source§

impl<'ast> ItemData<'ast> for ModItem<'ast>

Source§

impl<'ast> ItemData<'ast> for StaticItem<'ast>

Source§

impl<'ast> ItemData<'ast> for StructItem<'ast>

Source§

impl<'ast> ItemData<'ast> for TraitItem<'ast>

Source§

impl<'ast> ItemData<'ast> for TyAliasItem<'ast>

Source§

impl<'ast> ItemData<'ast> for UnionItem<'ast>

Source§

impl<'ast> ItemData<'ast> for UnstableItem<'ast>

Source§

impl<'ast> ItemData<'ast> for UseItem<'ast>