pub trait CppAstToken {
// Required methods
fn syntax(&self) -> &CppSyntaxToken;
fn can_cast(kind: CppTokenKind) -> bool
where Self: Sized;
fn cast(syntax: CppSyntaxToken) -> Option<Self>
where Self: Sized;
// Provided methods
fn get_token_kind(&self) -> CppTokenKind { ... }
fn get_token_data(&self) -> CppTokenData { ... }
fn get_position(&self) -> TextSize { ... }
fn get_range(&self) -> TextRange { ... }
fn get_syntax_id(&self) -> CppSyntaxId { ... }
fn get_text(&self) -> &str { ... }
fn get_parent<N: CppAstNode>(&self) -> Option<N> { ... }
fn ancestors<N: CppAstNode>(&self) -> impl Iterator<Item = N> { ... }
fn dump(&self) -> String { ... }
}Expand description
A typed syntax token.
Required Methods§
fn syntax(&self) -> &CppSyntaxToken
fn can_cast(kind: CppTokenKind) -> boolwhere
Self: Sized,
fn cast(syntax: CppSyntaxToken) -> Option<Self>where
Self: Sized,
Provided Methods§
fn get_token_kind(&self) -> CppTokenKind
Sourcefn get_token_data(&self) -> CppTokenData
fn get_token_data(&self) -> CppTokenData
The token’s own data, for callers that want to pass it around without the tree.
fn get_position(&self) -> TextSize
fn get_range(&self) -> TextRange
fn get_syntax_id(&self) -> CppSyntaxId
fn get_text(&self) -> &str
fn get_parent<N: CppAstNode>(&self) -> Option<N>
fn ancestors<N: CppAstNode>(&self) -> impl Iterator<Item = N>
fn dump(&self) -> String
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".