Enum rustc_expand::mbe::TokenTree [−][src]
enum TokenTree {
Token(Token),
Delimited(DelimSpan, Lrc<Delimited>),
Sequence(DelimSpan, Lrc<SequenceRepetition>),
MetaVar(Span, Ident),
MetaVarDecl(Span, Ident, Option<NonterminalKind>),
}Expand description
Similar to tokenstream::TokenTree, except that $i, $i:ident, and $(...)
are “first-class” token trees. Useful for parsing macros.
Variants
Token(Token)Sequence(DelimSpan, Lrc<SequenceRepetition>)Expand description
A kleene-style repetition sequence
Expand description
e.g., $var
MetaVarDecl(Span, Ident, Option<NonterminalKind>)Expand description
e.g., $var:expr. This is only used in the left hand side of MBE macros.
Implementations
impl TokenTree[src]
impl TokenTree[src]fn is_delimited(&self) -> bool[src]
fn is_delimited(&self) -> bool[src]Returns true if the given token tree is delimited.
fn is_token(&self, expected_kind: &TokenKind) -> bool[src]
fn is_token(&self, expected_kind: &TokenKind) -> bool[src]Returns true if the given token tree is a token of the given kind.
fn get_tt(&self, index: usize) -> TokenTree[src]
fn get_tt(&self, index: usize) -> TokenTree[src]Gets the index-th sub-token-tree. This only makes sense for delimited trees and sequences.
fn token(kind: TokenKind, span: Span) -> TokenTree[src]
Trait Implementations
impl StructuralPartialEq for TokenTree[src]
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
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)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more