Skip to main content

Parser

Trait Parser 

Source
pub trait Parser: Send + Sync {
    // Required methods
    fn extensions(&self) -> &[&str];
    fn source_type(&self) -> SourceType;
    fn parse(&self, path: &Path, content: &str) -> Result<Document>;
}
Expand description

Trait for document parsers.

Required Methods§

Source

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

File extensions this parser handles (without dot, lowercase).

Source

fn source_type(&self) -> SourceType

Source type for parsed documents.

Source

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

Parse file content into a Document. Implementations must call doc.assign_node_ids() before returning.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§