Use the Node<T> data structure
masterThe core abstraction is Node<T>. You provide a type T (usually an enum or struct) that defines which fields you want to extract from the AST. This allows you to selectively deserialize only the data you need, improving performance and stability against Clang updates.
By convention, name your type T as Clang.
pub struct Node<T> {
pub id: Id,
pub kind: T,
pub inner: Vec<Node<T>>,
}pub struct Node<T> {
pub id: Id,
pub kind: T,
pub inner: Vec<Node<T>>,
}