Trait Renderer

Source
pub trait Renderer: Debug {
    // Provided methods
    fn initialize(&mut self, config: &mut Config<'_>) { ... }
    fn render_type(&mut self, ctx: &mut Context<'_, '_>, ty: &TypeData<'_>) { ... }
    fn finish(&mut self, config: &Config<'_>, module: &mut Module) { ... }
}
Expand description

Trait that is used to define a renderer.

A renderer is used to generate the actual code of a specific TypeData. The idea is that different renderers generate different code. This can be used by the user to compose different renderers depending on his needs, or he could even implement customized renderers on his own.

Provided Methods§

Source

fn initialize(&mut self, config: &mut Config<'_>)

Initialized the renderer.

This is called once for each renderer when the generator is initialized.

Source

fn render_type(&mut self, ctx: &mut Context<'_, '_>, ty: &TypeData<'_>)

Renders the code for the given type.

This is called once for each type that needs to be rendered.

Source

fn finish(&mut self, config: &Config<'_>, module: &mut Module)

Finishes the rendering process.

This is called once for each renderer after the actual rendering of the types is finished and the code generation process is being finished.

Implementors§