pub trait TokenTreeExt: Into<TokenTree> + Sized {
Show 25 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_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
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.