8 releases

0.2.3 Apr 8, 2022
0.2.2 Apr 8, 2022
0.2.1 Apr 6, 2021
0.1.3 Apr 2, 2021

#443 in Configuration

Download history 1267/week @ 2024-03-14 1746/week @ 2024-03-21 1129/week @ 2024-03-28 1185/week @ 2024-04-04 1099/week @ 2024-04-11 1142/week @ 2024-04-18 1544/week @ 2024-04-25 1346/week @ 2024-05-02 996/week @ 2024-05-09 880/week @ 2024-05-16 980/week @ 2024-05-23 1072/week @ 2024-05-30 996/week @ 2024-06-06 1650/week @ 2024-06-13 1662/week @ 2024-06-20 1076/week @ 2024-06-27

5,593 downloads per month
Used in 2 crates

BSD-2-Clause

9KB
125 lines

config-file

API Docs Downloads

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();

lib.rs:

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();

Dependencies

~0.4–1.5MB
~33K SLoC