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

#509 in Configuration

Download history 1680/week @ 2024-08-05 2702/week @ 2024-08-12 4696/week @ 2024-08-19 8322/week @ 2024-08-26 1806/week @ 2024-09-02 1778/week @ 2024-09-09 1060/week @ 2024-09-16 1575/week @ 2024-09-23 1297/week @ 2024-09-30 1189/week @ 2024-10-07 1364/week @ 2024-10-14 1532/week @ 2024-10-21 1782/week @ 2024-10-28 1609/week @ 2024-11-04 1253/week @ 2024-11-11 1206/week @ 2024-11-18

6,058 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.3–1.4MB
~32K SLoC