[go: up one dir, main page]

figment 0.10.11

A configuration library so con-free, it's unreal.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use figment::{Figment, providers::{Toml, Format}};
use serde::Deserialize;

#[derive(Debug, Deserialize, PartialEq)]
struct Foo(pub isize);

#[derive(Debug, Deserialize, PartialEq)]
struct Config {
    foo: Foo
}

#[test]
fn one_value() {
    let config: Config = Figment::from(Toml::string("foo = 42")).extract().unwrap();
    assert_eq!(config, Config {
        foo: Foo(42)
    })
}