pub trait RedTreeExt<'a, L: Language> {
// Required methods
fn traverse_pre_order(&self, visitor: &mut impl Visitor<'a, L>);
fn traverse_post_order(&self, visitor: &mut impl Visitor<'a, L>);
fn find_nodes_by_type(
&self,
node_type: L::ElementType,
) -> Vec<RedNode<'a, L>>;
fn find_tokens_by_type(&self, token_type: L::TokenType) -> Vec<RedLeaf<L>>;
fn find_node_at_offset(&self, offset: usize) -> Option<RedTree<'a, L>>;
}Expand description
Extension methods for RedTree to make it easier to work with the AST processor.
Required Methods§
Sourcefn traverse_pre_order(&self, visitor: &mut impl Visitor<'a, L>)
fn traverse_pre_order(&self, visitor: &mut impl Visitor<'a, L>)
Traverses the tree in pre-order.
Sourcefn traverse_post_order(&self, visitor: &mut impl Visitor<'a, L>)
fn traverse_post_order(&self, visitor: &mut impl Visitor<'a, L>)
Traverses the tree in post-order.
Sourcefn find_nodes_by_type(&self, node_type: L::ElementType) -> Vec<RedNode<'a, L>>
fn find_nodes_by_type(&self, node_type: L::ElementType) -> Vec<RedNode<'a, L>>
Finds all nodes of the specified type.
Sourcefn find_tokens_by_type(&self, token_type: L::TokenType) -> Vec<RedLeaf<L>>
fn find_tokens_by_type(&self, token_type: L::TokenType) -> Vec<RedLeaf<L>>
Finds all tokens of the specified type.
Sourcefn find_node_at_offset(&self, offset: usize) -> Option<RedTree<'a, L>>
fn find_node_at_offset(&self, offset: usize) -> Option<RedTree<'a, L>>
Finds the node at the specified offset.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".