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

#492 in Configuration

Download history 1274/week @ 2024-07-28 1619/week @ 2024-08-04 2748/week @ 2024-08-11 4351/week @ 2024-08-18 8030/week @ 2024-08-25 2384/week @ 2024-09-01 1725/week @ 2024-09-08 1159/week @ 2024-09-15 1405/week @ 2024-09-22 1355/week @ 2024-09-29 1266/week @ 2024-10-06 1378/week @ 2024-10-13 1464/week @ 2024-10-20 1836/week @ 2024-10-27 1690/week @ 2024-11-03 964/week @ 2024-11-10

6,048 downloads per month
Used in 4 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.4MB
~32K SLoC