pub trait ServiceConfig:
Clone
+ Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn validate(&self) -> Result<(), PipelineError>;
fn default_config() -> Self;
fn merge(&self, other: &Self) -> Self;
}Expand description
Generic trait for service configuration validation and defaults
This trait defines the interface for service configuration management, providing validation, default values, and configuration merging capabilities.
§Key Features
- Validation: Comprehensive configuration validation
- Default Values: Sensible default configuration values
- Merging: Configuration merging and override capabilities
- Type Safety: Type-safe configuration management
§Implementation Requirements
Implementing types must:
- Be cloneable for configuration updates
- Be debuggable for error reporting
- Be thread-safe (
Send + Sync) - Have a stable lifetime (
'static)
§Examples
Required Methods§
Sourcefn validate(&self) -> Result<(), PipelineError>
fn validate(&self) -> Result<(), PipelineError>
Validates the configuration and returns errors if invalid
Sourcefn default_config() -> Self
fn default_config() -> Self
Returns default configuration
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.