Skip to main content

ConfigProvider

Trait ConfigProvider 

Source
pub trait ConfigProvider {
    type Config;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn load(&self) -> Result<Self::Config>;
    fn save(&self, config: &Self::Config) -> Result<()>;
    fn validate(&self, config: &Self::Config) -> Result<()>;
    fn default_config(&self) -> Self::Config;
}
Expand description

Configuration management abstraction

§Synchronous Version

This trait provides synchronous operations for configuration management.

Required Associated Types§

Source

type Config

The configuration type this provider handles

Source

type Error: Error + Send + Sync + 'static

The error type returned by configuration operations

Required Methods§

Source

fn load(&self) -> Result<Self::Config>

Load configuration from source

Source

fn save(&self, config: &Self::Config) -> Result<()>

Save configuration to source

Source

fn validate(&self, config: &Self::Config) -> Result<()>

Validate configuration

Source

fn default_config(&self) -> Self::Config

Get default configuration

Implementors§