Skip to main content

Parser

Trait Parser 

Source
pub trait Parser {
    // Required methods
    fn name(&self) -> &str;
    fn matches(&self, path: &str) -> bool;
    fn parse(&self, path: &str, content: &str) -> ParseResult;

    // Provided method
    fn parse_batch(
        &self,
        files: &[(&str, &str)],
    ) -> HashMap<String, ParseResult> { ... }
}
Expand description

Trait implemented by all parsers (built-in and custom).

Required Methods§

Source

fn name(&self) -> &str

Parser name — used as provenance on edges.

Source

fn matches(&self, path: &str) -> bool

Check if this parser should run on a given file path.

Source

fn parse(&self, path: &str, content: &str) -> ParseResult

Parse a file’s content and return discovered links + optional metadata.

Provided Methods§

Source

fn parse_batch(&self, files: &[(&str, &str)]) -> HashMap<String, ParseResult>

Parse multiple files in one call. Default falls back to per-file parsing. Custom parsers override this to spawn one process for all files.

Implementors§