Trait rustc_ap_rustc_ast::ast_like::AstLike[][src]

pub trait AstLike: Sized + Debug {
    const SUPPORTS_CUSTOM_INNER_ATTRS: bool;

    fn attrs(&self) -> &[Attribute];
fn visit_attrs(&mut self, f: impl FnOnce(&mut Vec<Attribute>));
fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>>; }
Expand description

An AstLike represents an AST node (or some wrapper around and AST node) which stores some combination of attributes and tokens.

Associated Constants

const SUPPORTS_CUSTOM_INNER_ATTRS: bool[src]

This is true if this AstLike might support ‘custom’ (proc-macro) inner attributes. Attributes like #![cfg] and #![cfg_attr] are not considered ‘custom’ attributes

If this is false, then this AstLike definitely does not support ‘custom’ inner attributes, which enables some optimizations during token collection.

Required methods

fn attrs(&self) -> &[Attribute][src]

fn visit_attrs(&mut self, f: impl FnOnce(&mut Vec<Attribute>))[src]

fn tokens_mut(&mut self) -> Option<&mut Option<LazyTokenStream>>[src]

Implementations on Foreign Types

impl<T: AstLike> AstLike for Option<T>[src]

Implementors

impl AstLike for StmtKind[src]

impl AstLike for Nonterminal[src]

impl AstLike for Arm[src]

impl AstLike for AttrItem[src]

impl AstLike for Attribute[src]

impl AstLike for Block[src]

impl AstLike for Expr[src]

impl AstLike for ExprField[src]

impl AstLike for FieldDef[src]

impl AstLike for GenericParam[src]

impl AstLike for Item[src]

impl AstLike for Local[src]

impl AstLike for MacCallStmt[src]

impl AstLike for Param[src]

impl AstLike for Pat[src]

impl AstLike for PatField[src]

impl AstLike for Path[src]

impl AstLike for Stmt[src]

impl AstLike for Ty[src]

impl AstLike for Variant[src]

impl AstLike for Visibility[src]

impl AstLike for AssocItem[src]

impl AstLike for ForeignItem[src]

impl<T: AstLike + 'static> AstLike for P<T>[src]