Skip to main content

ConfigSource

Trait ConfigSource 

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

Source

fn name(&self) -> &str

Config source name.

Source

fn load(&self, builder: &mut ConfigSourceBuilder<'_>) -> Result<(), ConfigError>

Load config source.

Provided Methods§

Source

fn allow_refresh(&self) -> bool

If this config source can be refreshed.

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§