Struct rustc_ap_rustc_ast::tokenstream::TokenStream[][src]

pub struct TokenStream(_);

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 backwards compatability.


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<TreeAndSpacing>) -> 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_ref(&self) -> CursorRef<'_>

Notable traits for CursorRef<'t>

impl<'t> Iterator for CursorRef<'t> type Item = &'t TokenTree;

pub fn trees(&self) -> Cursor

Notable traits for Cursor

impl Iterator for Cursor type Item = TokenTree;

pub fn into_trees(self) -> Cursor

Notable traits for Cursor

impl Iterator for Cursor type Item = TokenTree;

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>(
    f: F
) -> TokenStream

Trait Implementations

impl Clone for TokenStream[src]

impl CreateTokenStream for TokenStream[src]

impl Debug for TokenStream[src]

impl<__D: Decoder> Decodable<__D> for TokenStream[src]

impl Default for TokenStream[src]

impl<__E: Encoder> Encodable<__E> 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

impl PartialEq<TokenStream> for TokenStream[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<'a, T> Captures<'a> for T where
    T: ?Sized

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized

impl<T> Erased for T[src]

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

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,