Skip to main content

TokenTreeExt

Trait TokenTreeExt 

Source
pub trait TokenTreeExt: Sized + Sealed {
Show 13 methods // Required methods fn equals(&self, other: &Self) -> bool; fn is_group(&self) -> bool; fn is_ident(&self) -> bool; fn is_punct(&self) -> bool; fn is_literal(&self) -> bool; fn into_group(self) -> Result<Group, Self>; fn into_ident(self) -> Result<Ident, Self>; fn into_punct(self) -> Result<Punct, Self>; fn into_literal(self) -> Result<Literal, Self>; fn as_group(&self) -> Option<&Group>; fn as_ident(&self) -> Option<&Ident>; fn as_punct(&self) -> Option<&Punct>; fn as_literal(&self) -> Option<&Literal>;
}
Expand description

Extension trait for TokenTree.

Required Methods§

Source

fn equals(&self, other: &Self) -> bool

Checks if this token tree is equal to other.

Source

fn is_group(&self) -> bool

Checks if the token tree is a group.

Source

fn is_ident(&self) -> bool

Checks if the token tree is an ident.

Source

fn is_punct(&self) -> bool

Checks if the token tree is a punct.

Source

fn is_literal(&self) -> bool

Checks if the token tree is a literal.

Source

fn into_group(self) -> Result<Group, Self>

Require the token tree to be a group.

Source

fn into_ident(self) -> Result<Ident, Self>

Require the token tree to be an ident.

Source

fn into_punct(self) -> Result<Punct, Self>

Require the token tree to be a punct.

Source

fn into_literal(self) -> Result<Literal, Self>

Require the token tree to be a literal.

Source

fn as_group(&self) -> Option<&Group>

Returns the token tree as a group if it is one.

Source

fn as_ident(&self) -> Option<&Ident>

Returns the token tree as an ident if it is one.

Source

fn as_punct(&self) -> Option<&Punct>

Returns the token tree as a punct if it is one.

Source

fn as_literal(&self) -> Option<&Literal>

Returns the token tree as a literal if it is one.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TokenTreeExt for TokenTree

Source§

fn is_group(&self) -> bool

Source§

fn is_ident(&self) -> bool

Source§

fn is_punct(&self) -> bool

Source§

fn is_literal(&self) -> bool

Source§

fn equals(&self, other: &Self) -> bool

Source§

fn into_group(self) -> Result<Group, Self>

Source§

fn into_ident(self) -> Result<Ident, Self>

Source§

fn into_punct(self) -> Result<Punct, Self>

Source§

fn into_literal(self) -> Result<Literal, Self>

Source§

fn as_group(&self) -> Option<&Group>

Source§

fn as_ident(&self) -> Option<&Ident>

Source§

fn as_punct(&self) -> Option<&Punct>

Source§

fn as_literal(&self) -> Option<&Literal>

Implementors§