[−][src]Struct rustc_ap_rustc_ast::tokenstream::TokenStream
A TokenStream
is an abstract sequence of tokens, organized into TokenTree
s.
The goal is for procedural macros to work with TokenStream
s and TokenTree
s
instead of a representation of the abstract syntax tree.
Today's TokenTree
s can still contain AST via token::Interpolated
for back-compat.
Methods
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
[src]
pub fn into_trees(self) -> Cursor
[src]
pub fn eq_unspanned(&self, other: &TokenStream) -> bool
[src]
Compares two TokenStream
s, 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>(
self,
f: F
) -> TokenStream
[src]
self,
f: F
) -> TokenStream
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, f: F) -> TokenStream
[src]
Trait Implementations
impl Clone for TokenStream
[src]
fn clone(&self) -> TokenStream
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for TokenStream
[src]
impl Decodable for TokenStream
[src]
impl Default for TokenStream
[src]
fn default() -> TokenStream
[src]
impl Encodable for TokenStream
[src]
impl Eq for TokenStream
[src]
impl From<TokenTree> for TokenStream
[src]
fn from(tree: TokenTree) -> TokenStream
[src]
impl FromIterator<TokenTree> for TokenStream
[src]
fn from_iter<I: IntoIterator<Item = TokenTree>>(iter: I) -> Self
[src]
impl<CTX> HashStable<CTX> for TokenStream where
CTX: HashStableContext,
[src]
CTX: HashStableContext,
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher)
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Decodable for T where
T: UseSpecializedDecodable,
[src]
T: UseSpecializedDecodable,
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized,
[src]
T: UseSpecializedEncodable + ?Sized,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,