# Enum proc_macro::TokenTree[−][src]

    pub enum TokenTree {
        Group(Group),
        Term(Term),
        Op(Op),
        Literal(Literal),
    }

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

A single token or a delimited sequence of token trees (e.g. `[1, (), ..]`).

## Variants

`Group(Group)`
🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

A delimited tokenstream

`Term(Term)`
🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

A unicode identifier

`Op(Op)`
🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

A punctuation character (`+`, `,`, `$`, etc.).

`Literal(Literal)`
🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

A literal character (`'a'`), string (`"hello"`), number (`2.3`), etc.

## Methods

###

`impl TokenTree`

[src]

####

`pub fn span(&self) -> Span`

[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Returns the span of this token, accessing the `span` method of each of the internal tokens.

####

`pub fn set_span(&mut self, span: Span)`

[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Configures the span for only this token.

Note that if this token is a `Group` then this method will not configure the span of each of the internal tokens, this will simply delegate to the `set_span` method of each variant.

## Trait Implementations

###

`impl From<TokenTree> for TokenStream`

[src]

####

`fn from(tree: TokenTree) -> TokenStream`

[src]

Performs the conversion.

###

`impl FromIterator<TokenTree> for TokenStream`

[src]

####

`fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self`

[src]

Creates a value from an iterator. Read more

###

`impl Clone for TokenTree`

[src]

####

`fn clone(&self) -> TokenTree`

[src]

Returns a copy of the value. Read more

####

`fn clone_from(&mut self, source: &Self)`

1.0.0
[src]

Performs copy-assignment from `source`. Read more

###

`impl Debug for TokenTree`

[src]

####

`fn fmt(&self, f: &mut Formatter) -> Result`

[src]

Formats the value using the given formatter. Read more

###

`impl From<Group> for TokenTree`

[src]

####

`fn from(g: Group) -> TokenTree`

[src]

Performs the conversion.

###

`impl From<Term> for TokenTree`

[src]

####

`fn from(g: Term) -> TokenTree`

[src]

Performs the conversion.

###

`impl From<Op> for TokenTree`

[src]

####

`fn from(g: Op) -> TokenTree`

[src]

Performs the conversion.

###

`impl From<Literal> for TokenTree`

[src]

####

`fn from(g: Literal) -> TokenTree`

[src]

Performs the conversion.

###

`impl Display for TokenTree`

[src]

####

`fn fmt(&self, f: &mut Formatter) -> Result`

[src]

Formats the value using the given formatter. Read more

## Auto Trait Implementations

###

`impl !Send for TokenTree`

###

`impl !Sync for TokenTree`

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)