ServiceConfig

Trait ServiceConfig 

Source
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§

Source

fn validate(&self) -> Result<(), PipelineError>

Validates the configuration and returns errors if invalid

Source

fn default_config() -> Self

Returns default configuration

Source

fn merge(&self, other: &Self) -> Self

Merges this configuration with another, preferring values from other

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.

Implementors§