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§
Sourcefn build(&self, config: &RenderConfig) -> Box<dyn DynRenderer>
fn build(&self, config: &RenderConfig) -> Box<dyn DynRenderer>
Builds a renderer from config.
Provided Methods§
Sourcefn validate_config(&self, _config: &RenderConfig) -> Result<(), PluginError>
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".