pub struct Builder<C: Config> { /* private fields */ }
Expand description

Convenience builder to configure, load and merge multiple configuration sources.

Sources specified earlier have a higher priority. Obtained via Config::builder.

Implementations

Adds a configuration file as source. Infers the format from the file extension. If the path has no file extension or the extension is unknown, Builder::load will return an error.

The file is not considered required: if the file does not exist, an empty configuration (C::Partial::empty()) is used for this layer.

Adds the environment variables as a source.

Adds an already loaded partial configuration as source.

Loads all configured sources in order. Earlier sources have a higher priority, later sources only fill potential gaps.

Will return an error if loading the sources fails or if the merged configuration does not specify all required values.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.