Struct proc_macro2::TokenStream
source · pub struct TokenStream { /* private fields */ }
Expand description
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.
Implementations§
Trait Implementations§
source§impl Clone for TokenStream
impl Clone for TokenStream
source§fn clone(&self) -> TokenStream
fn clone(&self) -> TokenStream
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TokenStream
impl Debug for TokenStream
Prints token in a form convenient for debugging.
source§impl Default for TokenStream
impl Default for TokenStream
TokenStream::default()
returns an empty stream,
i.e. this is equivalent with TokenStream::new()
.
source§impl Display for TokenStream
impl Display for TokenStream
Prints 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::Group
s with Delimiter::None
delimiters and negative
numeric literals.
source§impl Extend<TokenStream> for TokenStream
impl Extend<TokenStream> for TokenStream
source§fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I)
fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Extend<TokenTree> for TokenStream
impl Extend<TokenTree> for TokenStream
source§fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I)
fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl From<TokenStream> for TokenStream
impl From<TokenStream> for TokenStream
source§fn from(inner: TokenStream) -> Self
fn from(inner: TokenStream) -> Self
source§impl From<TokenStream> for TokenStream
impl From<TokenStream> for TokenStream
source§fn from(inner: TokenStream) -> Self
fn from(inner: TokenStream) -> Self
source§impl From<TokenTree> for TokenStream
impl From<TokenTree> for TokenStream
source§impl FromIterator<TokenStream> for TokenStream
impl FromIterator<TokenStream> for TokenStream
source§fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self
source§impl FromIterator<TokenTree> for TokenStream
impl FromIterator<TokenTree> for TokenStream
Collects a number of token trees into a single stream.
source§impl FromStr for TokenStream
impl FromStr for TokenStream
Attempts 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 LexError
s later.
Auto Trait Implementations§
impl Freeze for TokenStream
impl RefUnwindSafe for TokenStream
impl !Send for TokenStream
impl !Sync for TokenStream
impl Unpin for TokenStream
impl UnwindSafe for TokenStream
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)