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

#484 in Configuration

Download history 1776/week @ 2024-10-30 1502/week @ 2024-11-06 1343/week @ 2024-11-13 1213/week @ 2024-11-20 1594/week @ 2024-11-27 3291/week @ 2024-12-04 4743/week @ 2024-12-11 2644/week @ 2024-12-18 59162/week @ 2024-12-25 4557/week @ 2025-01-01 1043/week @ 2025-01-08 1577/week @ 2025-01-15 2114/week @ 2025-01-22 6194/week @ 2025-01-29 2205/week @ 2025-02-05 7459/week @ 2025-02-12

18,111 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
~30K SLoC