6 releases
| 0.11.5 | Apr 20, 2026 |
|---|---|
| 0.11.4 | Jan 4, 2026 |
| 0.11.3 | Dec 4, 2025 |
#150 in Configuration
18,356 downloads per month
Used in 2 crates
330KB
4.5K
SLoC
figment2

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.
Usage
Add the following to your Cargo.toml, enabling the desired built-in providers:
[dependencies]
figment2 = { version = "0.11", features = ["toml"] }
License
Figment is licensed under either of the following, at your option:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
Dependencies
~0.1–6MB
~135K SLoC