[−][src]Enum rustc_ap_rustc_ast::tokenstream::TokenTree
When the main rust parser encounters a syntax-extension invocation, it parses the arguments to the invocation as a token-tree. This is a very loose structure, such that all sorts of different AST-fragments can be passed to syntax extensions using a uniform type.
If the syntax extension is an MBE macro, it will attempt to match its
LHS token tree against the provided token tree, and if it finds a
match, will transcribe the RHS token tree, splicing in any captured
macro_parser::matched_nonterminals
into the SubstNt
s it finds.
The RHS of an MBE macro is the only place SubstNt
s are substituted.
Nothing special happens to misnamed or misplaced SubstNt
s.
Variants
Token(Token)
A single token
Delimited(DelimSpan, DelimToken, TokenStream)
A delimited sequence of token trees
Implementations
impl TokenTree
[src]
pub fn eq_unspanned(&self, other: &TokenTree) -> bool
[src]
Checks if this TokenTree is equal to the other, regardless of span information.
pub fn span(&self) -> Span
[src]
Retrieves the TokenTree's span.
pub fn set_span(&mut self, span: Span)
[src]
Modify the TokenTree
's span in-place.
pub fn joint(self) -> TokenStream
[src]
pub fn token(kind: TokenKind, span: Span) -> TokenTree
[src]
pub fn open_tt(span: DelimSpan, delim: DelimToken) -> TokenTree
[src]
Returns the opening delimiter as a token tree.
pub fn close_tt(span: DelimSpan, delim: DelimToken) -> TokenTree
[src]
Returns the closing delimiter as a token tree.
pub fn uninterpolate(self) -> TokenTree
[src]
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 From<TokenTree> for TokenStream
[src]
fn from(tree: TokenTree) -> TokenStream
[src]
impl From<TokenTree> for TreeAndJoint
[src]
fn from(tree: TokenTree) -> TreeAndJoint
[src]
impl FromIterator<TokenTree> for TokenStream
[src]
fn from_iter<I: IntoIterator<Item = TokenTree>>(iter: I) -> Self
[src]
impl<__CTX> HashStable<__CTX> for TokenTree where
__CTX: HashStableContext,
[src]
__CTX: HashStableContext,
fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)
[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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Erased for 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> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,