Enum swc_macros_common::prelude::TokenTree
source · [−]Expand description
A single token or a delimited sequence of token trees (e.g. [1, (), ..]
).
Variants
Group(Group)
A token stream surrounded by bracket delimiters.
Ident(Ident)
An identifier.
Punct(Punct)
A single punctuation character (+
, ,
, $
, etc.).
Literal(Literal)
A literal character ('a'
), string ("hello"
), number (2.3
), etc.
Implementations
Trait Implementations
sourceimpl Display for TokenTree
impl Display for TokenTree
Prints the token tree as a string that is supposed to be losslessly
convertible back into the same token tree (modulo spans), except for
possibly TokenTree::Group
s with Delimiter::None
delimiters and negative
numeric literals.
sourceimpl Extend<TokenTree> for TokenStream
impl Extend<TokenTree> for TokenStream
sourcefn extend<I>(&mut self, streams: I)where
I: IntoIterator<Item = TokenTree>,
fn extend<I>(&mut self, streams: I)where
I: IntoIterator<Item = TokenTree>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl From<TokenTree> for TokenStream
impl From<TokenTree> for TokenStream
sourcefn from(token: TokenTree) -> TokenStream
fn from(token: TokenTree) -> TokenStream
Converts to this type from the input type.
sourceimpl FromIterator<TokenTree> for TokenStream
impl FromIterator<TokenTree> for TokenStream
Collects a number of token trees into a single stream.
sourcefn from_iter<I>(streams: I) -> TokenStreamwhere
I: IntoIterator<Item = TokenTree>,
fn from_iter<I>(streams: I) -> TokenStreamwhere
I: IntoIterator<Item = TokenTree>,
Creates a value from an iterator. Read more
sourceimpl ToTokens for TokenTree
impl ToTokens for TokenTree
sourcefn to_tokens(&self, dst: &mut TokenStream)
fn to_tokens(&self, dst: &mut TokenStream)
sourcefn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
sourcefn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
impl Token for TokenTree
Auto Trait Implementations
impl RefUnwindSafe for TokenTree
impl !Send for TokenTree
impl !Sync for TokenTree
impl Unpin for TokenTree
impl UnwindSafe for TokenTree
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
sourcefn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty. Read moresourceimpl<T> ToTokensExt for Twhere
T: ToTokens,
impl<T> ToTokensExt for Twhere
T: ToTokens,
fn dump(&self) -> TokenStream
sourcefn first_last(&self) -> FirstLast
fn first_last(&self) -> FirstLast
Usage:
Quote::new(body.first_last())