pub trait IrMapping {
// Required method
fn classify(&self, node: &Node<'_>) -> Mapping;
// Provided methods
fn node_name<'s>(&self, node: &Node<'_>, source: &'s str) -> Option<&'s str> { ... }
fn token_kind(&self, kind: &str, is_named: bool, text: &str) -> TokenKind { ... }
}Expand description
The per-language part of a C-family structural frontend.
The shared walker owns tokenisation, error recovery and IR assembly; an implementation of this trait supplies the language’s node-mapping table. The provided methods cover the whole C family — the C++-only grammar kinds they mention never occur in C trees — so implementations rarely override them.
Required Methods§
Sourcefn classify(&self, node: &Node<'_>) -> Mapping
fn classify(&self, node: &Node<'_>) -> Mapping
Decide how one CST node maps onto the IR. This table is the granularity contract of a frontend; changing it changes fingerprint input, which invalidates every result recorded under the old table. Before the first release that is settled by rescanning rather than by raising the frontend version, which stays at v1.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".