pub enum TokenTree {
Group(Group),
Ident(Ident),
Punct(Punct),
Literal(Literal),
}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§
Source§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::Groups with Delimiter::None delimiters and negative
numeric literals.
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::Groups with Delimiter::None delimiters and negative
numeric literals.
Source§impl Extend<TokenTree> for TokenStream
impl Extend<TokenTree> for TokenStream
Source§fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, tokens: I)
fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, tokens: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn 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
Source§impl From<TokenTree> for TokenStream
impl From<TokenTree> for TokenStream
Source§impl FromIterator<TokenTree> for TokenStream
Collects a number of token trees into a single stream.
impl FromIterator<TokenTree> for TokenStream
Collects a number of token trees into a single stream.
Auto Trait Implementations§
impl !Send for TokenTree
impl !Sync for TokenTree
impl Forget for TokenTree
impl Freeze for TokenTree
impl Move for TokenTree
impl RefUnwindSafe for TokenTreewhere
NonZero<u32>: RefUnwindSafe,
RcVec<TokenTree>: RefUnwindSafe,
ProcMacroAutoTraits: RefUnwindSafe,
impl Unpin for TokenTree
impl UnsafeUnpin for TokenTreewhere
NonZeroU32Inner: UnsafeUnpin,
*const RcInner<Vec<TokenTree>> is !null: UnsafeUnpin,
PhantomData<RcInner<Vec<TokenTree>>>: UnsafeUnpin,
*const str is !null: UnsafeUnpin,
PhantomData<str>: UnsafeUnpin,
PhantomData<Rc<()>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for TokenTreewhere
NonZero<u32>: UnwindSafe,
Rc<Vec<TokenTree>>: UnwindSafe,
BoxRaw<str>: UnwindSafe,
ProcMacroAutoTraits: UnwindSafe,
RawVecInner: UnwindSafe,
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
Mutably borrows from an owned value. Read more