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

#590 in Configuration

Download history 1502/week @ 2024-01-08 969/week @ 2024-01-15 821/week @ 2024-01-22 1041/week @ 2024-01-29 840/week @ 2024-02-05 994/week @ 2024-02-12 1388/week @ 2024-02-19 1364/week @ 2024-02-26 1037/week @ 2024-03-04 1276/week @ 2024-03-11 1172/week @ 2024-03-18 1740/week @ 2024-03-25 1055/week @ 2024-04-01 1119/week @ 2024-04-08 1149/week @ 2024-04-15 1555/week @ 2024-04-22

5,027 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