Trait preserves_schema::compiler::Plugin

source ·
pub trait Plugin: Debug {
    // Required method
    fn generate_definition(
        &self,
        module_ctxt: &mut ModuleContext<'_, '_>,
        definition_name: &str,
        definition: &Definition
    );

    // Provided method
    fn generate_module(&self, _module_ctxt: &mut ModuleContext<'_, '_>) { ... }
}
Expand description

Implement this trait to extend the compiler with custom code generation support. The main code generators are also implemented as plugins.

For an example of its use outside the core compiler, see build.rs for the syndicate-rs project.

Required Methods§

source

fn generate_definition( &self, module_ctxt: &mut ModuleContext<'_, '_>, definition_name: &str, definition: &Definition )

Use module_ctxt to emit code at a per-Schema-Definition level.

Provided Methods§

source

fn generate_module(&self, _module_ctxt: &mut ModuleContext<'_, '_>)

Use _module_ctxt to emit code at a per-module level.

Implementors§