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§
Sourcefn initialize(&mut self, config: &mut Config<'_>)
fn initialize(&mut self, config: &mut Config<'_>)
Initialized the renderer.
This is called once for each renderer when the generator is initialized.
Sourcefn render_type(&mut self, ctx: &mut Context<'_, '_>, ty: &TypeData<'_>)
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.