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

#446 in Configuration

Download history 970/week @ 2023-11-23 687/week @ 2023-11-30 1176/week @ 2023-12-07 598/week @ 2023-12-14 475/week @ 2023-12-21 704/week @ 2023-12-28 1350/week @ 2024-01-04 1158/week @ 2024-01-11 860/week @ 2024-01-18 975/week @ 2024-01-25 854/week @ 2024-02-01 948/week @ 2024-02-08 1279/week @ 2024-02-15 1336/week @ 2024-02-22 1098/week @ 2024-02-29 819/week @ 2024-03-07

4,707 downloads per month
Used in du-dust

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