Skip to main content

ContentParser

Trait ContentParser 

Source
pub trait ContentParser: Send + Sync {
    // Required methods
    fn parse(&self, content: &str, path: &str) -> Result<ParsedContent>;
    fn supported_extensions(&self) -> &[&str];

    // Provided method
    fn can_parse(&self, path: &str) -> bool { ... }
}
Expand description

Trait for content parsers (L4).

Each parser handles a specific file format and extracts structured data for the detection engine.

Required Methods§

Source

fn parse(&self, content: &str, path: &str) -> Result<ParsedContent>

Parse the file content.

Source

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

Get the file extensions this parser supports.

Provided Methods§

Source

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

Check if this parser can handle the given file.

Implementors§