SourceParser

Trait SourceParser 

Source
pub trait SourceParser:
    Clone
    + Debug
    + Send
    + Sync {
    type ParsedSource: ParsedSource;

    // Required method
    fn new(config: &ProjectPathsConfig) -> Self;

    // Provided methods
    fn read(&mut self, path: &Path) -> Result<Node<Self::ParsedSource>> { ... }
    fn parse_sources(
        &mut self,
        sources: &mut Sources,
    ) -> Result<Vec<(PathBuf, Node<Self::ParsedSource>)>> { ... }
    fn finalize_imports(
        &mut self,
        _nodes: &mut Vec<Node<Self::ParsedSource>>,
        _include_paths: &BTreeSet<PathBuf>,
    ) -> Result<()> { ... }
}
Expand description

ParsedSource parser.

Required Associated Types§

Required Methods§

Source

fn new(config: &ProjectPathsConfig) -> Self

Creates a new parser for the given config.

Provided Methods§

Source

fn read(&mut self, path: &Path) -> Result<Node<Self::ParsedSource>>

Reads and parses the source file at the given path.

Source

fn parse_sources( &mut self, sources: &mut Sources, ) -> Result<Vec<(PathBuf, Node<Self::ParsedSource>)>>

Parses the sources in the given sources map.

Source

fn finalize_imports( &mut self, _nodes: &mut Vec<Node<Self::ParsedSource>>, _include_paths: &BTreeSet<PathBuf>, ) -> Result<()>

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§