プロジェクト
GitHubで見る Figment
SergioBenitez/Figment
概要
設定の面倒さを感じさせない、まるで現実とは思えないほど使いやすい階層型設定ライブラリ。
開発ツール計測したスター増加
- 24時間
- 0
- 7日間
- +4
- 15日間
- +3
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルFigment

Figment is a semi-hierarchical configuration library for Rust so con-free, it's unreal.
use serde::Deserialize;
use figment::{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]
figment = { version = "0.10", features = ["toml"] }
Third-Party Providers
The following external libraries implement Figment providers:
-
Wraps existing providers. For any key ending in
_FILE(configurable), emits a key without the_FILEsuffix with a value corresponding to the contents of the file whose path is the original key's value.
Please submit a pull request to add your library to this list.
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)
関連プロジェクトを探す
読み込み中…