[−][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.
Implementations
impl TokenStream
[src]
pub fn new() -> TokenStream
[src]
Returns an empty TokenStream
containing no token trees.
pub fn is_empty(&self) -> bool
[src]
Checks if this TokenStream
is empty.
Trait Implementations
impl Clone for TokenStream
[src]
pub fn clone(&self) -> TokenStream
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for TokenStream
[src]
Prints token in a form convenient for debugging.
impl Default for TokenStream
[src]
TokenStream::default()
returns an empty stream,
i.e. this is equivalent with TokenStream::new()
.
impl Display for TokenStream
[src]
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.
impl Extend<TokenStream> for TokenStream
[src]
pub fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl Extend<TokenTree> for TokenStream
[src]
pub fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl From<TokenStream> for TokenStream
[src]
pub fn from(inner: TokenStream) -> TokenStream
[src]
impl From<TokenStream> for TokenStream
[src]
pub fn from(inner: TokenStream) -> TokenStream
[src]
impl From<TokenTree> for TokenStream
[src]
impl FromIterator<TokenStream> for TokenStream
[src]
pub fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self
[src]
impl FromIterator<TokenTree> for TokenStream
[src]
Collects a number of token trees into a single stream.
pub fn from_iter<I: IntoIterator<Item = TokenTree>>(streams: I) -> Self
[src]
impl FromStr for TokenStream
[src]
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.
type Err = LexError
The associated error which can be returned from parsing.
pub fn from_str(src: &str) -> Result<TokenStream, LexError>
[src]
impl IntoIterator 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,
pub fn borrow_mut(&mut self) -> &mut 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
pub 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>,