[−][src]Struct syntax::tokenstream::TokenStream
Token Streams
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.
The use of Option is an optimization that avoids the need for an
allocation when the stream is empty. However, it is not guaranteed that an
empty stream is represented with None; it may be represented as a Some
around an empty Vec.
Methods
impl TokenStream[src]
impl TokenStreampub fn len(&self) -> usize | [src] |
pub fn empty() -> TokenStream | [src] |
pub fn is_empty(&self) -> bool | [src] |
pub fn new(streams: Vec<TreeAndJoint>) -> TokenStream | [src] |
pub fn append_to_tree_and_joint_vec(self, vec: &mut Vec<TreeAndJoint>) | [src] |
ⓘImportant traits for Cursor
pub fn trees(&self) -> Cursor | [src] |
ⓘImportant traits for Cursor
pub fn into_trees(self) -> Cursor | [src] |
pub fn eq_unspanned(&self, other: &TokenStream) -> bool | [src] |
Compares two TokenStreams, checking equality without regarding span information.
pub fn probably_equal_for_proc_macro(&self, other: &TokenStream) -> bool | [src] |
pub fn map_enumerated<F: FnMut(usize, TokenTree) -> TokenTree>( | [src] |
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStream | [src] |
Trait Implementations
impl PartialEq<TokenStream> for TokenStream[src]
impl PartialEq<TokenStream> for TokenStreamfn eq(&self, other: &TokenStream) -> bool | [src] |
| 1.0.0 [src] |
This method tests for !=.
impl Eq for TokenStream[src]
impl Eq for TokenStreamimpl Clone for TokenStream[src]
impl Clone for TokenStreamfn clone(&self) -> TokenStream | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source. Read more
impl From<TokenTree> for TokenStream[src]
impl From<TokenTree> for TokenStreamfn from(tree: TokenTree) -> TokenStream | [src] |
impl From<Token> for TokenStream[src]
impl From<Token> for TokenStreamfn from(token: Token) -> TokenStream | [src] |
impl Display for TokenStream[src]
impl Display for TokenStreamimpl Debug for TokenStream[src]
impl Debug for TokenStreamimpl<T: Into<TokenStream>> FromIterator<T> for TokenStream[src]
impl<T: Into<TokenStream>> FromIterator<T> for TokenStreamfn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self | [src] |
impl Encodable for TokenStream[src]
impl Encodable for TokenStreamimpl Decodable for TokenStream[src]
impl Decodable for TokenStreamAuto Trait Implementations
impl !Send for TokenStream
impl !Send for TokenStreamimpl !Sync for TokenStream
impl !Sync for TokenStreamBlanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, impl<T> From for T[src]
impl<T> From for Timpl<T> ToString for T where
T: Display + ?Sized, [src]
impl<T> ToString for T where
T: Display + ?Sized, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized, [src]
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized, impl<T> Decodable for T where
T: UseSpecializedDecodable, [src]
impl<T> Decodable for T where
T: UseSpecializedDecodable, impl<E> SpecializationError for E[src]
impl<E> SpecializationError for Eimpl<T> Erased for T[src]
impl<T> Erased for Timpl<T> Send for T where
T: ?Sized, [src]
impl<T> Send for T where
T: ?Sized, impl<T> Sync for T where
T: ?Sized, [src]
impl<T> Sync for T where
T: ?Sized, impl<T> Erased for T
impl<T> Erased for T