Struct syntax::tokenstream::TokenStream
[−]
[src]
pub struct TokenStream { /* fields omitted */ }Token Streams
A TokenStream is an abstract sequence of tokens, organized into TokenTrees.
The goal is for procedural macros to work with TokenStreams and TokenTrees
instead of a representation of the abstract syntax tree.
Today's TokenTrees can still contain AST via Token::Interpolated for back-compat.
Methods
impl TokenStream[src]
pub fn len(&self) -> usize[src]
pub fn empty() -> TokenStream[src]
pub fn is_empty(&self) -> bool[src]
pub fn concat(streams: Vec<TokenStream>) -> TokenStream[src]
ⓘImportant traits for Cursorpub fn trees(&self) -> Cursor[src]
ⓘImportant traits for Cursorpub fn into_trees(self) -> Cursor[src]
pub fn eq_unspanned(&self, other: &TokenStream) -> bool[src]
Compares two TokenStreams, checking equality without regarding span information.
pub fn as_tree(self) -> (TokenTree, bool)[src]
Precondition: self consists of a single token tree.
Returns true if the token tree is a joint operation w.r.t. proc_macro::TokenNode.
pub fn map_enumerated<F: FnMut(usize, TokenTree) -> TokenTree>(
self,
f: F
) -> TokenStream[src]
self,
f: F
) -> TokenStream
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStream[src]
Trait Implementations
impl Clone for TokenStream[src]
fn clone(&self) -> TokenStream[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for TokenStream[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl From<TokenTree> for TokenStream[src]
fn from(tt: TokenTree) -> TokenStream[src]
Performs the conversion.
impl From<Token> for TokenStream[src]
fn from(token: Token) -> TokenStream[src]
Performs the conversion.
impl<T: Into<TokenStream>> FromIterator<T> for TokenStream[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self[src]
Creates a value from an iterator. Read more
impl Eq for TokenStream[src]
impl PartialEq<TokenStream> for TokenStream[src]
fn eq(&self, other: &TokenStream) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl From<TokenStream> for ThinTokenStream[src]
fn from(stream: TokenStream) -> ThinTokenStream[src]
Performs the conversion.
impl From<ThinTokenStream> for TokenStream[src]
fn from(stream: ThinTokenStream) -> TokenStream[src]
Performs the conversion.
impl Display for TokenStream[src]
fn fmt(&self, f: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more