Trait TokenStream

Source
pub trait TokenStream:
    ProcMacro
    + Default
    + Display
    + Extend<Self::TokenStream>
    + Extend<Self::TokenTree>
    + From<Self::TokenTree>
    + FromIterator<Self::TokenStream>
    + FromIterator<Self::TokenTree>
    + FromStr
    + IntoIterator<IntoIter = Self::TokenStreamIntoIter, Item = Self::TokenTree> {
    // Required methods
    fn new() -> Self;
    fn is_empty(&self) -> bool;
}
Expand description

TokenStream API trait. See proc_macro::TokenStream.

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

See also TokenStreamExt.

Required Methods§

Source

fn new() -> Self

Make an empty TokenStream.

Source

fn is_empty(&self) -> bool

Check if this TokenStream is empty.

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 TokenStream for TokenStream

Available on crate feature proc-macro only.
Source§

fn new() -> Self

Source§

fn is_empty(&self) -> bool

Source§

impl TokenStream for TokenStream

Available on crate feature proc-macro2 only.
Source§

fn new() -> Self

Source§

fn is_empty(&self) -> bool

Implementors§