| Crates.io | mogh_config |
| lib.rs | mogh_config |
| version | 1.0.1 |
| created_at | 2026-01-17 21:08:30.519578+00 |
| updated_at | 2026-01-17 22:06:32.430701+00 |
| description | Utilities to merge config from multiple files / directories. |
| homepage | |
| repository | https://github.com/moghtech/lib |
| max_upload_size | |
| id | 2051165 |
| size | 28,864 |
Module for comprehensive loading of strongly typed configuration files using std::fs and serde.
#[derive(serde::Deserialize)]
struct Config {
title: String,
aliases: Vec<String>,
endpoint: String,
use_option: bool,
}
let config = (ConfigLoader {
// Read config files from a directory
paths: vec![PathBuf::from("./configs")],
match_wildcards: vec![String::from("*config*.toml")],
// It won't recurse into subdirectories unless they include '.configinclude' file
include_file_name: ".configinclude",
merge_nested: true,
extend_array: true,
debug_print: true,
})
.load::<Config>()
.expect("Failed to parse config from path");