config-rs icon indicating copy to clipboard operation
config-rs copied to clipboard

Use a HashMap for a config entry without changing the case

Open galou opened this issue 1 year ago • 0 comments

I have a config that contains an entry watched_variables that I want to deserialize into the WatchedVariables structure defined below

{
    "watched_variables": {
        "PickObject": ["n_objects"],
    },
}
#[derive(Clone, Debug, Default)]
pub struct WatchedVariables(pub HashMap<String, Vec<String>>);

I tried to use #derive(Deserialize) but the key gets converted to lower case.

How can I deserialize this without any modification of the key?

galou avatar Sep 24 '24 12:09 galou