pub trait ConfigSource: Send {
// Required methods
fn name(&self) -> &str;
fn load(
&self,
builder: &mut ConfigSourceBuilder<'_>,
) -> Result<(), ConfigError>;
// Provided methods
fn allow_refresh(&self) -> bool { ... }
fn refreshable(&self) -> Result<bool, ConfigError> { ... }
}
Expand description
Config source.
Config source examples:
- Load from programming.
- Load from environment.
- Load from file.
- Load from network.
- …
Required Methods§
Sourcefn load(&self, builder: &mut ConfigSourceBuilder<'_>) -> Result<(), ConfigError>
fn load(&self, builder: &mut ConfigSourceBuilder<'_>) -> Result<(), ConfigError>
Load config source.
Provided Methods§
Sourcefn allow_refresh(&self) -> bool
fn allow_refresh(&self) -> bool
If this config source can be refreshed.
Sourcefn refreshable(&self) -> Result<bool, ConfigError>
fn refreshable(&self) -> Result<bool, ConfigError>
Check if config source is refreshable.
Implementor should notice that everytime this method is called, the refreshable state must be reset to false.