Skip to main content

RedTreeExt

Trait RedTreeExt 

Source
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§

Source

fn traverse_pre_order(&self, visitor: &mut impl Visitor<'a, L>)

Traverses the tree in pre-order.

Source

fn traverse_post_order(&self, visitor: &mut impl Visitor<'a, L>)

Traverses the tree in post-order.

Source

fn find_nodes_by_type(&self, node_type: L::ElementType) -> Vec<RedNode<'a, L>>

Finds all nodes of the specified type.

Source

fn find_tokens_by_type(&self, token_type: L::TokenType) -> Vec<RedLeaf<L>>

Finds all tokens of the specified type.

Source

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", so this trait is not object safe.

Implementors§

Source§

impl<'a, L: Language> RedTreeExt<'a, L> for RedTree<'a, L>