Trait TokenTree

Source
pub trait TokenTree:
    ProcMacro<TokenTree = Self>
    + Display
    + From<Self::Group>
    + From<Self::Ident>
    + From<Self::Punct>
    + From<Self::Literal> {
    // Required methods
    fn span(&self) -> Self::Span;
    fn set_span(&mut self, span: Self::Span);
}
Expand description

TokenTree API trait. See proc_macro::TokenTree.

This trait is implemented for TokenTree in proc_macro and proc_macro2 if the corresponding feature is enabled.

See also TokenTreeExt.

Required Methods§

Source

fn span(&self) -> Self::Span

Get the span of this TokenTree.

Source

fn set_span(&mut self, span: Self::Span)

Set the span of this TokenTree. If the TokenTree is a Group, this will use Group::set_span.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TokenTree for TokenTree

Available on crate feature proc-macro only.
Source§

fn span(&self) -> Self::Span

Source§

fn set_span(&mut self, span: Self::Span)

Source§

impl TokenTree for TokenTree

Available on crate feature proc-macro2 only.
Source§

fn span(&self) -> Self::Span

Source§

fn set_span(&mut self, span: Self::Span)

Implementors§