[][src]Struct proc_macro2::TokenStream

pub struct TokenStream { /* fields omitted */ }

An abstract stream of tokens, or more concretely a sequence of token trees.

This type provides interfaces for iterating over token trees and for collecting token trees into one stream.

Token stream is both the input and output of #[proc_macro], #[proc_macro_attribute] and #[proc_macro_derive] definitions.

Methods

impl TokenStream[src]

pub fn new() -> TokenStream[src]

Returns an empty TokenStream containing no token trees.

pub fn empty() -> TokenStream[src]

Deprecated since 0.4.4:

please use TokenStream::new

pub fn is_empty(&self) -> bool[src]

Checks if this TokenStream is empty.

Trait Implementations

impl Clone for TokenStream[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for TokenStream[src]

TokenStream::default() returns an empty stream, i.e. this is equivalent with TokenStream::new().

impl From<TokenStream> for TokenStream[src]

impl From<TokenStream> for TokenStream[src]

impl IntoIterator for TokenStream[src]

type Item = TokenTree

The type of the elements being iterated over.

type IntoIter = IntoIter

Which kind of iterator are we turning this into?

impl Extend<TokenTree> for TokenStream[src]

impl Extend<TokenStream> for TokenStream[src]

impl Display for TokenStream[src]

Prints the token stream as a string that is supposed to be losslessly convertible back into the same token stream (modulo spans), except for possibly TokenTree::Groups with Delimiter::None delimiters and negative numeric literals.

impl Debug for TokenStream[src]

Prints token in a form convenient for debugging.

impl FromIterator<TokenTree> for TokenStream[src]

Collects a number of token trees into a single stream.

impl FromIterator<TokenStream> for TokenStream[src]

impl FromStr for TokenStream[src]

Attempts to break the string into tokens and parse those tokens into a token stream.

May fail for a number of reasons, for example, if the string contains unbalanced delimiters or characters not existing in the language.

NOTE: Some errors may cause panics instead of returning LexError. We reserve the right to change these errors into LexErrors later.

type Err = LexError

The associated error which can be returned from parsing.

Auto Trait Implementations

impl !Send for TokenStream

impl !Sync for TokenStream

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]