Hi there,
I'm new to rust and config-rs, and I'm facing an annoying problem: I can't get structs with #[serde(rename_all = "camelCase")] to work.
I've setup a simple demo repository here to illustrate my problem.
My Toml:
My struct:
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct Settings {
snake_test: String,
}
My main:
fn main() {
let mut c = config::Config::default();
c.merge(config::File::new("Settings", config::FileFormat::Toml))
.unwrap();
// Deserialize the entire file as single struct
let s: Settings = c.try_into::<Settings>().unwrap();
println!("{:?}", s);
}
The error:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: missing field `snakeTest`', libcore/result.rs:916:5
Am I missing something? Thanks!
Hi there,
I'm new to rust and config-rs, and I'm facing an annoying problem: I can't get structs with
#[serde(rename_all = "camelCase")]to work.I've setup a simple demo repository here to illustrate my problem.
My Toml:
My struct:
My main:
The error:
Am I missing something? Thanks!