Struct syn::buffer::TokenBuffer
source · pub struct TokenBuffer { /* private fields */ }
Available on crate feature
parsing
only.Expand description
A buffer that can be efficiently traversed multiple times, unlike
TokenStream
which requires a deep copy in order to traverse more than
once.
Implementations§
source§impl TokenBuffer
impl TokenBuffer
sourcepub fn new(stream: TokenStream) -> Self
Available on crate feature proc-macro
only.
pub fn new(stream: TokenStream) -> Self
proc-macro
only.Creates a TokenBuffer
containing all the tokens from the input
proc_macro::TokenStream
.
sourcepub fn new2(stream: TokenStream) -> Self
pub fn new2(stream: TokenStream) -> Self
Creates a TokenBuffer
containing all the tokens from the input
proc_macro2::TokenStream
.