Skip to main content

ConfigSource

Trait ConfigSource 

Source
pub trait ConfigSource {
    // Required method
    fn load(&self) -> Result<ConfigValue, ParserError>;

    // Provided method
    fn priority(&self) -> u8 { ... }
}
Expand description

Trait defining a configuration source.

A ConfigSource is an entity capable of yielding a ConfigValue, which can represent configuration data from various sources, such as files, environment variables, or CLI arguments.

Required Methods§

Source

fn load(&self) -> Result<ConfigValue, ParserError>

Load configuration from the source.

Returns a Result containing either the configuration value (ConfigValue) or a parsing error (ParserError) if loading fails.

Provided Methods§

Source

fn priority(&self) -> u8

Defines the priority of this configuration source.

Sources with higher priority override those with lower priority during merging.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§