Skip to main content

ConfigSource

Trait ConfigSource 

Source
pub trait ConfigSource {
    // Required method
    fn config_path(&self) -> Option<&Path>;

    // Provided method
    fn config_format(&self) -> Option<ConfigFormat> { ... }
}
Expand description

Provides configuration path and format discovery for fallback loading.

Required Methods§

Source

fn config_path(&self) -> Option<&Path>

Returns the config file path when fallback should be attempted.

Provided Methods§

Source

fn config_format(&self) -> Option<ConfigFormat>

Returns a config format if it can be resolved.

The default implementation infers from extension:

  • .toml (toml feature)
  • .yaml / .yml (yaml feature)
  • .json (json feature)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§