Struct proc_macro::TokenStream 1.15.0[−][src]
pub struct TokenStream(_);
Expand description
The main type provided by this crate, representing an abstract stream of tokens, or, more specifically, a sequence of token trees. The type provide interfaces for iterating over those token trees and, conversely, collecting a number of token trees into one stream.
This is both the input and output of #[proc_macro], #[proc_macro_attribute]
and #[proc_macro_derive] definitions.
Implementations
impl TokenStream[src]
impl TokenStream[src]Trait Implementations
impl Clone for TokenStream[src]
impl Clone for TokenStream[src]fn clone(&self) -> TokenStream[src]
fn clone(&self) -> TokenStream[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
impl Debug for TokenStream[src]
impl Debug for TokenStream[src]Prints token in a form convenient for debugging.
impl Default for TokenStream1.45.0[src]
impl Default for TokenStream1.45.0[src]impl Display for TokenStream[src]
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::Groups
with Delimiter::None delimiters and negative numeric literals.
impl Extend<TokenStream> for TokenStream1.30.0[src]
impl Extend<TokenStream> for TokenStream1.30.0[src]fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I)[src]
fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I)[src]Extends a collection with the contents of an iterator. Read more
fn extend_reserve(&mut self, additional: usize)[src]
fn extend_reserve(&mut self, additional: usize)[src]Reserves capacity in a collection for the given number of additional elements. Read more
impl Extend<TokenTree> for TokenStream1.30.0[src]
impl Extend<TokenTree> for TokenStream1.30.0[src]fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, trees: I)[src]
fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, trees: I)[src]Extends a collection with the contents of an iterator. Read more
fn extend_reserve(&mut self, additional: usize)[src]
fn extend_reserve(&mut self, additional: usize)[src]Reserves capacity in a collection for the given number of additional elements. Read more
impl From<TokenTree> for TokenStream1.29.0[src]
impl From<TokenTree> for TokenStream1.29.0[src]Creates a token stream containing a single token tree.
fn from(tree: TokenTree) -> TokenStream[src]
fn from(tree: TokenTree) -> TokenStream[src]Performs the conversion.
impl FromIterator<TokenStream> for TokenStream[src]
impl FromIterator<TokenStream> for TokenStream[src]A “flattening” operation on token streams, collects token trees from multiple token streams into a single stream.
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self[src]
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self[src]Creates a value from an iterator. Read more
impl FromIterator<TokenTree> for TokenStream1.29.0[src]
impl FromIterator<TokenTree> for TokenStream1.29.0[src]Collects a number of token trees into a single stream.
fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self[src]
fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self[src]Creates a value from an iterator. Read more
impl FromStr for TokenStream[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.
All tokens in the parsed stream get Span::call_site() spans.
NOTE: some errors may cause panics instead of returning LexError. We reserve the right to
change these errors into LexErrors later.
impl IntoIterator for TokenStream1.29.0[src]
impl IntoIterator for TokenStream1.29.0[src]impl ToString for TokenStream[src]
impl ToString for TokenStream[src]impl !Send for TokenStream[src]
impl !Sync for TokenStream[src]
Auto Trait Implementations
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into #41263)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more