Trait TokenTreeExt

Source
pub trait TokenTreeExt: Into<TokenTree> + Sized {
Show 37 methods // Provided methods fn as_ident(&self) -> Option<&Ident> { ... } fn as_punct(&self) -> Option<&Punct> { ... } fn as_group(&self) -> Option<&Group> { ... } fn as_literal(&self) -> Option<&Literal> { ... } fn into_ident(self) -> Result<Ident, Self> { ... } fn into_punct(self) -> Result<Punct, Self> { ... } fn into_group(self) -> Result<Group, Self> { ... } fn into_literal(self) -> Result<Literal, Self> { ... } fn to_ident(&self) -> Result<&Ident, &Self> { ... } fn to_punct(&self) -> Result<&Punct, &Self> { ... } fn to_group(&self) -> Result<&Group, &Self> { ... } fn to_literal(&self) -> Result<&Literal, &Self> { ... } fn is_ident(&self) -> bool { ... } fn is_punct(&self) -> bool { ... } fn is_group(&self) -> bool { ... } fn is_literal(&self) -> bool { ... } fn kind(&self) -> TokenKind { ... } fn is_keyword(&self, keyword: &str) -> bool { ... } fn is_punch(&self, ch: char) -> bool { ... } fn is_solid_group(&self) -> bool { ... } fn is_delimiter(&self, delimiter: Delimiter) -> bool { ... } fn is_delimiter_paren(&self) -> bool { ... } fn is_delimiter_brace(&self) -> bool { ... } fn is_delimiter_bracket(&self) -> bool { ... } fn is_delimiter_none(&self) -> bool { ... } fn to_paren_stream(&self) -> Result<TokenStream, &Self> { ... } fn to_brace_stream(&self) -> Result<TokenStream, &Self> { ... } fn to_bracket_stream(&self) -> Result<TokenStream, &Self> { ... } fn to_none_stream(&self) -> Result<TokenStream, &Self> { ... } fn into_paren_stream(self) -> Result<TokenStream, Self> { ... } fn into_brace_stream(self) -> Result<TokenStream, Self> { ... } fn into_bracket_stream(self) -> Result<TokenStream, Self> { ... } fn into_none_stream(self) -> Result<TokenStream, Self> { ... } fn is_joint(&self) -> bool { ... } fn as_punct_char(&self) -> Option<char> { ... } fn tt(self) -> TokenTree { ... } fn unit_stream(self) -> TokenStream { ... }
}

Provided Methods§

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

fn to_ident(&self) -> Result<&Ident, &Self>

Source

fn to_punct(&self) -> Result<&Punct, &Self>

Source

fn to_group(&self) -> Result<&Group, &Self>

Source

fn to_literal(&self) -> Result<&Literal, &Self>

Source

fn is_ident(&self) -> bool

Source

fn is_punct(&self) -> bool

Source

fn is_group(&self) -> bool

Source

fn is_literal(&self) -> bool

Source

fn kind(&self) -> TokenKind

Source

fn is_keyword(&self, keyword: &str) -> bool

Ident content equal to keyword str

Other return false when self is not Ident

Source

fn is_punch(&self, ch: char) -> bool

Punct char equal to ch

Other return false when self is not Punct

Source

fn is_solid_group(&self) -> bool

Group delimiter is not Delimiter::None

Other return false when self is not Group

Source

fn is_delimiter(&self, delimiter: Delimiter) -> bool

Group delimiter equal to delimiter

Other return false when self is not Group

Source

fn is_delimiter_paren(&self) -> bool

Source

fn is_delimiter_brace(&self) -> bool

Source

fn is_delimiter_bracket(&self) -> bool

Source

fn is_delimiter_none(&self) -> bool

Source

fn to_paren_stream(&self) -> Result<TokenStream, &Self>

Call Group::stream when delimiter is Delimiter::Parenthesis

Other return false when self is not Group

Source

fn to_brace_stream(&self) -> Result<TokenStream, &Self>

Call Group::stream when delimiter is Delimiter::Brace

Other return false when self is not Group

Source

fn to_bracket_stream(&self) -> Result<TokenStream, &Self>

Call Group::stream when delimiter is Delimiter::Bracket

Other return false when self is not Group

Source

fn to_none_stream(&self) -> Result<TokenStream, &Self>

Call Group::stream when delimiter is Delimiter::None

Other return false when self is not Group

Source

fn into_paren_stream(self) -> Result<TokenStream, Self>

Like to_paren_stream, but using Self instead of &Self

Source

fn into_brace_stream(self) -> Result<TokenStream, Self>

Like to_brace_stream, but using Self instead of &Self

Source

fn into_bracket_stream(self) -> Result<TokenStream, Self>

Like to_bracket_stream, but using Self instead of &Self

Source

fn into_none_stream(self) -> Result<TokenStream, Self>

Like to_none_stream, but using Self instead of &Self

Source

fn is_joint(&self) -> bool

Punct spacing is Joint

Other return false when self is not Punct

Source

fn as_punct_char(&self) -> Option<char>

Source

fn tt(self) -> TokenTree

Source

fn unit_stream(self) -> TokenStream

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§

impl TokenTreeExt for Group

Source§

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

Source§

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

Source§

fn kind(&self) -> TokenKind

Source§

fn is_solid_group(&self) -> bool

Source§

fn is_delimiter(&self, delimiter: Delimiter) -> bool

Source§

impl TokenTreeExt for Ident

Source§

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

Source§

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

Source§

fn kind(&self) -> TokenKind

Source§

impl TokenTreeExt for Literal

Source§

impl TokenTreeExt for Punct

Source§

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

Source§

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

Source§

fn kind(&self) -> TokenKind

Implementors§