pub trait ConfigProvider: Send + Sync {
// Required methods
fn load_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn save_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn validate_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn config_exists<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn config_path(&self) -> Option<&Path>;
fn as_any(&self) -> &dyn Any;
}Expand description
Trait for configuration providers (YAML, JSON, environment, etc.)
Required Methods§
Sourcefn load_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load configuration from the provider
Sourcefn save_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save configuration to the provider
Sourcefn validate_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 Config,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate configuration format and structure
Sourcefn config_exists<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn config_exists<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if configuration exists
Sourcefn config_path(&self) -> Option<&Path>
fn config_path(&self) -> Option<&Path>
Get configuration file path (if applicable)