Skip to main content

RendererFactory

Trait RendererFactory 

Source
pub trait RendererFactory {
    // Required method
    fn build(&self, config: &RenderConfig) -> Box<dyn DynRenderer>;

    // Provided method
    fn validate_config(&self, _config: &RenderConfig) -> Result<(), PluginError> { ... }
}
Expand description

Factory for object-safe renderers.

Required Methods§

Source

fn build(&self, config: &RenderConfig) -> Box<dyn DynRenderer>

Builds a renderer from config.

Provided Methods§

Source

fn validate_config(&self, _config: &RenderConfig) -> Result<(), PluginError>

Validates a renderer configuration before building it.

The default implementation accepts every configuration, preserving compatibility with existing plugin factories. Factories with renderer-specific options can override this hook so PluginRegistry::build_renderer reports invalid input before a renderer is constructed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§