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§
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
Sourcefn is_keyword(&self, keyword: &str) -> bool
fn is_keyword(&self, keyword: &str) -> bool
Ident content equal to keyword
str
Other return false
when self
is not Ident
Sourcefn is_punch(&self, ch: char) -> bool
fn is_punch(&self, ch: char) -> bool
Punct char equal to ch
Other return false
when self
is not Punct
Sourcefn is_solid_group(&self) -> bool
fn is_solid_group(&self) -> bool
Group delimiter is not Delimiter::None
Other return false
when self
is not Group
Sourcefn is_delimiter(&self, delimiter: Delimiter) -> bool
fn is_delimiter(&self, delimiter: Delimiter) -> bool
Group delimiter equal to delimiter
Other return false
when self
is not Group
Sourcefn is_delimiter_paren(&self) -> bool
fn is_delimiter_paren(&self) -> bool
Sourcefn is_delimiter_brace(&self) -> bool
fn is_delimiter_brace(&self) -> bool
Sourcefn is_delimiter_bracket(&self) -> bool
fn is_delimiter_bracket(&self) -> bool
Sourcefn is_delimiter_none(&self) -> bool
fn is_delimiter_none(&self) -> bool
Sourcefn to_paren_stream(&self) -> Result<TokenStream, &Self>
fn to_paren_stream(&self) -> Result<TokenStream, &Self>
Call Group::stream
when delimiter
is Delimiter::Parenthesis
Other return false
when self
is not Group
Sourcefn to_brace_stream(&self) -> Result<TokenStream, &Self>
fn to_brace_stream(&self) -> Result<TokenStream, &Self>
Call Group::stream
when delimiter
is Delimiter::Brace
Other return false
when self
is not Group
Sourcefn to_bracket_stream(&self) -> Result<TokenStream, &Self>
fn to_bracket_stream(&self) -> Result<TokenStream, &Self>
Call Group::stream
when delimiter
is Delimiter::Bracket
Other return false
when self
is not Group
Sourcefn to_none_stream(&self) -> Result<TokenStream, &Self>
fn to_none_stream(&self) -> Result<TokenStream, &Self>
Call Group::stream
when delimiter
is Delimiter::None
Other return false
when self
is not Group
Sourcefn into_paren_stream(self) -> Result<TokenStream, Self>
fn into_paren_stream(self) -> Result<TokenStream, Self>
Like to_paren_stream
,
but using Self
instead of &Self
Sourcefn into_brace_stream(self) -> Result<TokenStream, Self>
fn into_brace_stream(self) -> Result<TokenStream, Self>
Like to_brace_stream
,
but using Self
instead of &Self
Sourcefn into_bracket_stream(self) -> Result<TokenStream, Self>
fn into_bracket_stream(self) -> Result<TokenStream, Self>
Like to_bracket_stream
,
but using Self
instead of &Self
Sourcefn into_none_stream(self) -> Result<TokenStream, Self>
fn into_none_stream(self) -> Result<TokenStream, Self>
Like to_none_stream
,
but using Self
instead of &Self
fn as_punct_char(&self) -> Option<char>
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.