Type Alias Expr

Source
pub type Expr = TokenStream;

Aliased Type§

struct Expr { /* private fields */ }

Implementations

Source§

impl TokenStream

Source

pub fn new() -> TokenStream

Returns an empty TokenStream containing no token trees.

Source

pub fn is_empty(&self) -> bool

Checks if this TokenStream is empty.

Trait Implementations

Source§

impl Clone for TokenStream

Source§

fn clone(&self) -> TokenStream

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TokenStream

Prints token in a form convenient for debugging.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for TokenStream

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

Source§

fn default() -> TokenStream

Returns the “default value” for a type. Read more
Source§

impl Display for TokenStream

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.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Extend<TokenStream> for TokenStream

Source§

fn extend<I>(&mut self, streams: I)
where I: IntoIterator<Item = TokenStream>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<TokenTree> for TokenStream

Source§

fn extend<I>(&mut self, streams: I)
where I: IntoIterator<Item = TokenTree>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<TokenStream> for TokenStream

Source§

fn from(inner: TokenStream) -> TokenStream

Converts to this type from the input type.
Source§

impl From<TokenTree> for TokenStream

Source§

fn from(token: TokenTree) -> TokenStream

Converts to this type from the input type.
Source§

impl FromIterator<TokenStream> for TokenStream

Source§

fn from_iter<I>(streams: I) -> TokenStream
where I: IntoIterator<Item = TokenStream>,

Creates a value from an iterator. Read more
Source§

impl FromIterator<TokenTree> for TokenStream

Collects a number of token trees into a single stream.

Source§

fn from_iter<I>(streams: I) -> TokenStream
where I: IntoIterator<Item = TokenTree>,

Creates a value from an iterator. Read more
Source§

impl FromStr for TokenStream

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.

Source§

type Err = LexError

The associated error which can be returned from parsing.
Source§

fn from_str(src: &str) -> Result<TokenStream, LexError>

Parses a string s to return a value of this type. Read more
Source§

impl IntoIterator for TokenStream

Source§

type Item = TokenTree

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> IntoIter

Creates an iterator from a value. Read more
Source§

impl Parse for TokenStream

Source§

impl ToTokens for TokenStream

Source§

fn to_tokens(&self, tokens: &mut TokenStream)

Write self to the given TokenStream. Read more
Source§

fn into_token_stream(self) -> TokenStream

Convert self directly into a TokenStream object. Read more
Source§

fn to_token_stream(&self) -> TokenStream

Convert self directly into a TokenStream object. Read more
Source§

impl TokenStreamExt for TokenStream

Source§

fn append<U>(&mut self, token: U)
where U: Into<TokenTree>,

For use by ToTokens implementations. Read more
Source§

fn append_all<I>(&mut self, iter: I)

For use by ToTokens implementations. Read more
Source§

fn append_separated<I, U>(&mut self, iter: I, op: U)

For use by ToTokens implementations. Read more
Source§

fn append_terminated<I, U>(&mut self, iter: I, term: U)

For use by ToTokens implementations. Read more