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

#721 in Configuration

Download history 1514/week @ 2024-09-27 1381/week @ 2024-10-04 1157/week @ 2024-10-11 1365/week @ 2024-10-18 1887/week @ 2024-10-25 1726/week @ 2024-11-01 1213/week @ 2024-11-08 1385/week @ 2024-11-15 1482/week @ 2024-11-22 1367/week @ 2024-11-29 5958/week @ 2024-12-06 2320/week @ 2024-12-13 53452/week @ 2024-12-20 8375/week @ 2024-12-27 4226/week @ 2025-01-03 1156/week @ 2025-01-10

67,415 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
~31K SLoC