configparser-rs
configparser-rs copied to clipboard
How to convert `HashMap<String, T>` to configparser ini String?
I would like to save a config file with data sourced from HashMap<String, T>. Is there a easy way to construct Ini and serialize it to a String?
I would like to save a config file with data sourced from
HashMap<String, T>. Is there a easy way to constructIniand serialize it to a String?
Two ways, consider T as Option<String> and serialize to HashMap<String("default"), HashMap<String, Option<String>>, which outputs a flat ini-file with no header (the default header is modifiable). Second is to consider T as HashMap<String, Option<String>> in which case, each string in the original hashmap becomes a header.