[][src]Struct rustc_ast::tokenstream::TokenStream

pub struct TokenStream(pub Lrc<Vec<TreeAndJoint>>);

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.

Implementations

impl TokenStream[src]

pub fn add_comma(&self) -> Option<(TokenStream, Span)>[src]

Given a TokenStream with a Stream of only two arguments, return a new TokenStream separating the two arguments with a comma for diagnostic suggestions.

impl TokenStream[src]

pub fn new(streams: Vec<TreeAndJoint>) -> TokenStream[src]

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

pub fn len(&self) -> usize[src]

pub fn span(&self) -> Option<Span>[src]

pub fn from_streams(streams: SmallVec<[TokenStream; 2]>) -> TokenStream[src]

pub fn trees(&self) -> Cursor

Important traits for Cursor

impl Iterator for Cursor type Item = TokenTree;
[src]

pub fn into_trees(self) -> Cursor

Important traits for Cursor

impl Iterator for Cursor type Item = TokenTree;
[src]

pub fn eq_unspanned(&self, other: &TokenStream) -> bool[src]

Compares two TokenStreams, checking equality without regarding span information.

pub fn map_enumerated<F: FnMut(usize, TokenTree) -> TokenTree>(
    self,
    f: F
) -> TokenStream
[src]

pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStream[src]

Trait Implementations

impl Clone for TokenStream[src]

impl Debug for TokenStream[src]

impl Decodable for TokenStream[src]

impl Default for TokenStream[src]

impl Encodable for TokenStream[src]

impl Eq for TokenStream[src]

impl From<TokenTree> for TokenStream[src]

impl FromIterator<TokenTree> for TokenStream[src]

impl<CTX> HashStable<CTX> for TokenStream where
    CTX: HashStableContext
[src]

impl PartialEq<TokenStream> for TokenStream[src]

Auto Trait Implementations

impl !RefUnwindSafe for TokenStream

impl !Send for TokenStream

impl !Sync for TokenStream

impl Unpin for TokenStream

impl !UnwindSafe for TokenStream

Blanket Implementations

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

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

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

impl<T> Decodable for T where
    T: UseSpecializedDecodable
[src]

impl<T> Encodable for T where
    T: UseSpecializedEncodable + ?Sized
[src]

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.