Crate config_file[][src]

Read and parse configuration file automatically

config-file reads your configuration files and parse them automatically using their extension.

Features

  • toml is enabled by default
  • json is optional
  • xml is optional
  • yaml is optional

Examples

use config_file::FromConfigFile;
use serde::Deserialize;

#[derive(Deserialize)]
struct Config {
    host: String,
}

let config = Config::from_config_file("/etc/myconfig.toml").unwrap();

Enums

ConfigFileError

This type represents all possible errors that can occur when loading data from a configuration file.

Traits

FromConfigFile

Trait for loading a struct from a configuration file. This trait is automatically implemented when serde::Deserialize is.