Enum TokenTree

enum TokenTree

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

impl TokenTree

fn span(self: &Self) -> Span

Returns the span of this tree, delegating to the span method of the contained token or a delimited stream.

fn set_span(self: &mut Self, span: Span)

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.

impl Clone for TokenTree

fn clone(self: &Self) -> TokenTree

impl Debug for TokenTree

fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result

impl Display for TokenTree

fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result

impl Freeze for TokenTree

impl From for TokenTree

fn from(g: Group) -> Self

impl From for TokenTree

fn from(g: Literal) -> Self

impl From for TokenTree

fn from(g: Punct) -> Self

impl From for TokenTree

fn from(g: Ident) -> Self

impl RefUnwindSafe for TokenTree

impl Send for TokenTree

impl Sync for TokenTree

impl Unpin for TokenTree

impl UnwindSafe for TokenTree

impl<T> Any for TokenTree

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for TokenTree

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for TokenTree

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for TokenTree

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for TokenTree

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for TokenTree

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> ToString for TokenTree

fn to_string(self: &Self) -> String

impl<T, U> Into for TokenTree

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for TokenTree

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for TokenTree

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>