1.15.0[][src]Struct proc_macro::TokenStream

pub struct TokenStream(_);

The main type provided by this crate, representing an abstract stream of tokens, or, more specifically, a sequence of token trees. The type provide interfaces for iterating over those token trees and, conversely, collecting a number of token trees into one stream.

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

Methods

impl TokenStream
[src]

Returns an empty TokenStream containing no token trees.

Checks if this TokenStream is empty.

Trait Implementations

impl !Sync for TokenStream
[src]

impl ToString for TokenStream
[src]

impl From<TokenTree> for TokenStream
1.29.0
[src]

Creates a token stream containing a single token tree.

impl !Send for TokenStream
[src]

impl Clone for TokenStream
[src]

Performs copy-assignment from source. Read more

impl IntoIterator for TokenStream
1.29.0
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

impl Extend<TokenTree> for TokenStream
1.30.0
[src]

impl Extend<TokenStream> for TokenStream
1.30.0
[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
1.29.0
[src]

Collects a number of token trees into a single stream.

impl FromIterator<TokenStream> for TokenStream
[src]

A "flattening" operation on token streams, collects token trees from multiple token streams into a single stream.

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. All tokens in the parsed stream get Span::call_site() spans.

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

The associated error which can be returned from parsing.

Blanket Implementations

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

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

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

impl<T> From for T
[src]

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

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

🔬 This is a nightly-only experimental API. (try_from #33417)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from #33417)

The type returned in the event of a conversion error.

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