Skip to main content

GeneratorFactory

Trait GeneratorFactory 

Source
pub trait GeneratorFactory: Send + Sync {
    // Required methods
    fn descriptor(&self) -> &'static GeneratorDescriptor;
    fn compile(
        &self,
        config: &GeneratorConfig,
        context: &CompileContext<'_>,
    ) -> Result<Box<dyn CompiledGenerator>, DiagnosticBag>;
}
Expand description

Compiles a GeneratorConfig into a runnable generator.

Required Methods§

Source

fn descriptor(&self) -> &'static GeneratorDescriptor

This generator’s static description.

Source

fn compile( &self, config: &GeneratorConfig, context: &CompileContext<'_>, ) -> Result<Box<dyn CompiledGenerator>, DiagnosticBag>

Validate config and build a runtime generator, or return a DiagnosticBag describing every problem found.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§