[−][src]Enum rustc_expand::mbe::TokenTree
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>)A kleene-style repetition sequence
e.g., $var
MetaVarDecl(Span, Ident, NonterminalKind)e.g., $var:expr. This is only used in the left hand side of MBE macros.
Implementations
impl TokenTree[src]
pub(in mbe) fn len(
&self
) -> usize[src]
&self
) -> usize
Return the number of tokens in the tree.
pub(in mbe) fn is_delimited(
&self
) -> bool[src]
&self
) -> bool
Returns true if the given token tree is delimited.
pub(in mbe) fn is_token(
&self,
expected_kind: &TokenKind
) -> bool[src]
&self,
expected_kind: &TokenKind
) -> bool
Returns true if the given token tree is a token of the given kind.
pub(in mbe) fn get_tt(
&self,
index: usize
) -> TokenTree[src]
&self,
index: usize
) -> TokenTree
Gets the index-th sub-token-tree. This only makes sense for delimited trees and sequences.
pub(in mbe) fn span(
&self
) -> Span[src]
&self
) -> Span
Retrieves the TokenTree's span.
pub(in mbe) fn token(
kind: TokenKind,
span: Span
) -> TokenTree[src]
kind: TokenKind,
span: Span
) -> TokenTree
Trait Implementations
impl Clone for TokenTree[src]
impl Debug for TokenTree[src]
impl<__D: Decoder> Decodable<__D> for TokenTree[src]
impl<__E: Encoder> Encodable<__E> for TokenTree[src]
impl PartialEq<TokenTree> for TokenTree[src]
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> 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, 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>,