Hi,
I'm not sure why but i cannot get enums working with ron.
My test file:
#![cfg(feature = "ron")]
use serde_derive::Deserialize;
use config::{Config, File, FileFormat};
#[derive(Debug, Deserialize)]
enum A {
VariantA{ port: u16 },
}
#[derive(Debug, Deserialize)]
struct Settings {
a: A,
}
fn make() -> Config {
Config::builder()
.add_source(File::new("tests/test.ron", FileFormat::Ron))
.build()
.unwrap()
}
#[test]
fn test_myron() {
let c = make();
// Deserialize the entire file as single struct
let s: Settings = c.try_deserialize().unwrap();
dbg!(&s);
}
My config file:
(
a: VariantA(port: 5000)
)
I get the error:
thread 'test_myron' panicked at tests/test_ron.rs:28:43:
called `Result::unwrap()` on an `Err` value: enum A does not have variant constructor port
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
even though serializing the Settings manually to ron gives the same string
Hi, I'm not sure why but i cannot get enums working with ron.
My test file:
My config file:
I get the error:
even though serializing the
Settings
manually to ron gives the same string