pub trait TokenTreeExt: Sized {
Show 17 methods
// Required 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>;
// Provided methods
fn is_ident(&self) -> bool { ... }
fn is_punct(&self) -> bool { ... }
fn is_group(&self) -> bool { ... }
fn is_literal(&self) -> bool { ... }
fn is_keyword(&self, keyword: &str) -> bool { ... }
fn is_punch(&self, ch: char) -> bool { ... }
fn is_solid_group(&self) -> bool { ... }
fn is_joint(&self) -> bool { ... }
fn as_punct_char(&self) -> Option<char> { ... }
}
Required 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>
Provided Methods§
fn is_ident(&self) -> bool
fn is_punct(&self) -> bool
fn is_group(&self) -> bool
fn is_literal(&self) -> bool
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
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.