Skip to main content

SemanticParserPlugin

Trait SemanticParserPlugin 

Source
pub trait SemanticParserPlugin: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn extensions(&self) -> &[&str];
    fn extract_entities(
        &self,
        content: &str,
        file_path: &str,
    ) -> Vec<SemanticEntity>;

    // Provided methods
    fn extract_entities_with_tree(
        &self,
        content: &str,
        file_path: &str,
    ) -> (Vec<SemanticEntity>, Option<Tree>) { ... }
    fn structural_hash_content(
        &self,
        _content: &str,
        _file_path: &str,
    ) -> Option<String> { ... }
    fn compute_similarity(&self, a: &SemanticEntity, b: &SemanticEntity) -> f64 { ... }
}

Required Methods§

Source

fn id(&self) -> &str

Source

fn extensions(&self) -> &[&str]

Source

fn extract_entities( &self, content: &str, file_path: &str, ) -> Vec<SemanticEntity>

Provided Methods§

Source

fn extract_entities_with_tree( &self, content: &str, file_path: &str, ) -> (Vec<SemanticEntity>, Option<Tree>)

Extract entities and optionally return the tree-sitter Tree for reuse. Default returns None for the tree (non-code plugins).

Source

fn structural_hash_content( &self, _content: &str, _file_path: &str, ) -> Option<String>

Source

fn compute_similarity(&self, a: &SemanticEntity, b: &SemanticEntity) -> f64

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§