File: tuple-struct.rs

package info (click to toggle)
rust-figment 0.10.19-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 508 kB
  • sloc: sh: 68; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 386 bytes parent folder | download
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)
    })
}