| Crates.io | figment2 |
| lib.rs | figment2 |
| version | 0.11.4 |
| created_at | 2025-12-03 12:29:27.937352+00 |
| updated_at | 2026-01-04 17:32:15.647445+00 |
| description | Remaintained fork of figment: A configuration library so con-free, it's unreal. |
| homepage | |
| repository | https://github.com/lmmx/figment2 |
| max_upload_size | |
| id | 1963941 |
| size | 369,044 |
Remaintained fork of figment
Figment2 is a semi-hierarchical configuration library for Rust so con-free, it's unreal.
use serde::Deserialize;
use figment2::{Figment, providers::{Format, Toml, Json, Env}};
#[derive(Deserialize)]
struct Package {
name: String,
authors: Vec<String>,
publish: Option<bool>,
// ... and so on ...
}
#[derive(Deserialize)]
struct Config {
package: Package,
rustc: Option<String>,
// ... and so on ...
}
let config: Config = Figment::new()
.merge(Toml::file("Cargo.toml"))
.merge(Env::prefixed("CARGO_"))
.merge(Env::raw().only(&["RUSTC", "RUSTDOC"]))
.join(Json::file("Cargo.json"))
.extract()?;
See the documentation for a detailed usage guide and information.
Add the following to your Cargo.toml, enabling the desired built-in providers:
[dependencies]
figment2 = { version = "0.11", features = ["toml"] }
Figment is licensed under either of the following, at your option: