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]
impl TokenStreampub fn len(&self) -> usize[src]
pub fn len(&self) -> usizepub fn empty() -> TokenStream[src]
pub fn empty() -> TokenStreampub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> boolpub 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) -> Cursorpub fn eq_unspanned(&self, other: &TokenStream) -> bool[src]
pub fn eq_unspanned(&self, other: &TokenStream) -> boolCompares 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) -> boolpub 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
) -> TokenStreampub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStream[src]
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStreamTrait Implementations
impl Clone for TokenStream[src]
impl Clone for TokenStreamfn clone(&self) -> TokenStream[src]
fn clone(&self) -> TokenStreamReturns 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 TokenStreamfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl From<TokenTree> for TokenStream[src]
impl From<TokenTree> for TokenStreamfn from(tt: TokenTree) -> TokenStream[src]
fn from(tt: TokenTree) -> TokenStreamPerforms the conversion.
impl From<Token> for TokenStream[src]
impl From<Token> for TokenStreamfn from(token: Token) -> TokenStream[src]
fn from(token: Token) -> TokenStreamPerforms the conversion.
impl<T: Into<TokenStream>> FromIterator<T> for TokenStream[src]
impl<T: Into<TokenStream>> FromIterator<T> for TokenStreamfn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> SelfCreates a value from an iterator. Read more
impl Eq for TokenStream[src]
impl Eq for TokenStreamimpl PartialEq<TokenStream> for TokenStream[src]
impl PartialEq<TokenStream> for TokenStreamfn eq(&self, other: &TokenStream) -> bool[src]
fn eq(&self, other: &TokenStream) -> boolThis 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]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl From<TokenStream> for ThinTokenStream[src]
impl From<TokenStream> for ThinTokenStreamfn from(stream: TokenStream) -> ThinTokenStream[src]
fn from(stream: TokenStream) -> ThinTokenStreamPerforms the conversion.
impl From<ThinTokenStream> for TokenStream[src]
impl From<ThinTokenStream> for TokenStreamfn from(stream: ThinTokenStream) -> TokenStream[src]
fn from(stream: ThinTokenStream) -> TokenStreamPerforms the conversion.
impl Display for TokenStream[src]
impl Display for TokenStreamfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Encodable for TokenStream[src]
impl Encodable for TokenStreamimpl Decodable for TokenStream[src]
impl Decodable for TokenStreamimpl Hash for TokenStream[src]
impl Hash for TokenStreamAuto Trait Implementations
impl !Send for TokenStream
impl !Send for TokenStreamimpl !Sync for TokenStream
impl !Sync for TokenStream