summaryrefslogtreecommitdiffstats
path: root/tests/424.rs
blob: d0d42e73d495a9221ba1379a84f6ed512f89b78d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use config::Config;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Serialize, Deserialize)]
enum EType {
    E1,
    E2(u64),
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SType {
    f1: EType,
}

impl SType {
    pub fn new(path: &str) -> Self {
        let config = Config::builder()
            .add_source(config::File::with_name(path))
            .build()
            .unwrap();
        config.try_deserialize::<SType>().unwrap()
    }
}

#[test]
fn test_424() {
    println!("{:?}", SType::new("tests/424.yaml"));
}