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