Skip to main content

SourcePlugin

Trait SourcePlugin 

Source
pub trait SourcePlugin: Sync {
    // Required methods
    fn flavor(&self) -> SourceFlavor;
    fn extensions(&self) -> &'static [&'static str];
    fn import_syntax(&self) -> FrontendImportSyntax;
    fn parse_source(&self, source: &str) -> Result<FrontendIr, ParseError>;

    // Provided methods
    fn parser_dialect(&self) -> Option<&'static dyn ParserDialect> { ... }
    fn parse_module_imports(
        &self,
        _source: &str,
        _path: &Path,
    ) -> Result<Vec<ModuleImport>, SourcePathError> { ... }
    fn strip_import_directives(&self, source: &str) -> String { ... }
}

Required Methods§

Source

fn flavor(&self) -> SourceFlavor

Source

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

Source

fn import_syntax(&self) -> FrontendImportSyntax

Source

fn parse_source(&self, source: &str) -> Result<FrontendIr, ParseError>

Provided Methods§

Source

fn parser_dialect(&self) -> Option<&'static dyn ParserDialect>

Source

fn parse_module_imports( &self, _source: &str, _path: &Path, ) -> Result<Vec<ModuleImport>, SourcePathError>

Source

fn strip_import_directives(&self, source: &str) -> String

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§