[−][src]Struct proc_macro2::TokenStream
An abstract stream of tokens, or more concretely a sequence of token trees.
This type provides interfaces for iterating over token trees and for collecting token trees into one stream.
Token stream is both the input and output of #[proc_macro],
#[proc_macro_attribute] and #[proc_macro_derive] definitions.
Methods
impl TokenStream[src]
impl TokenStreampub fn new() -> TokenStream[src]
pub fn new() -> TokenStreamReturns an empty TokenStream containing no token trees.
pub fn empty() -> TokenStream[src]
pub fn empty() -> TokenStream: please use TokenStream::new
pub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> boolChecks if this TokenStream is empty.
Trait Implementations
impl Default for TokenStream[src]
impl Default for TokenStreamTokenStream::default() returns an empty stream,
i.e. this is equivalent with TokenStream::new().
impl From<TokenStream> for TokenStream[src]
impl From<TokenStream> for TokenStreamfn from(inner: TokenStream) -> TokenStream[src]
fn from(inner: TokenStream) -> TokenStreamimpl From<TokenStream> for TokenStream[src]
impl From<TokenStream> for TokenStreamfn from(inner: TokenStream) -> TokenStream[src]
fn from(inner: TokenStream) -> TokenStreamimpl Clone for TokenStream[src]
impl Clone for TokenStreamfn clone(&self) -> TokenStream[src]
fn clone(&self) -> TokenStreamfn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl IntoIterator for TokenStream[src]
impl IntoIterator for TokenStreamtype Item = TokenTree
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
ⓘImportant traits for IntoIterfn into_iter(self) -> IntoIter[src]
fn into_iter(self) -> IntoIterimpl Extend<TokenTree> for TokenStream[src]
impl Extend<TokenTree> for TokenStreamfn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I)[src]
fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I)impl Extend<TokenStream> for TokenStream[src]
impl Extend<TokenStream> for TokenStreamfn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I)[src]
fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I)impl Display for TokenStream[src]
impl Display for TokenStreamPrints 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.
impl Debug for TokenStream[src]
impl Debug for TokenStreamPrints token in a form convenient for debugging.
impl FromIterator<TokenTree> for TokenStream[src]
impl FromIterator<TokenTree> for TokenStreamCollects a number of token trees into a single stream.
fn from_iter<I: IntoIterator<Item = TokenTree>>(streams: I) -> Self[src]
fn from_iter<I: IntoIterator<Item = TokenTree>>(streams: I) -> Selfimpl FromIterator<TokenStream> for TokenStream[src]
impl FromIterator<TokenStream> for TokenStreamfn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self[src]
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Selfimpl FromStr for TokenStream[src]
impl FromStr for TokenStreamAttempts 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.
Auto 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> ToString for T where
T: Display + ?Sized, [src]
impl<T> ToString for T where
T: Display + ?Sized, 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<I> IntoIterator for I where
I: Iterator, [src]
impl<I> IntoIterator for I where
I: Iterator, type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I[src]
fn into_iter(self) -> Iimpl<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]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>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]
fn get_type_id(&self) -> TypeIdimpl<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]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>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]
fn borrow_mut(&mut self) -> &mut T