Closed uwejan closed 10 months ago
Yes. Simply serialize your config structure, or the entire Figment itself, to your desired format and write it out.
@SergioBenitez , Basically std::fs::write ..etc, after dealing with string struct/serialization. I thought the crate might have a way say state.set / state.override ('path', value).
It's really rather straightforward:
let toml_string = toml::to_string_pretty(&figment)?;
std::fs::write("path.toml", &toml_string)?;
I thought the crate might have a way say state.set / state.override ('path', value).
What is state
? If you serialize/deserialize into a typed structure, as encouraged by Figment, then you just need foo.path = value
. If you want to work with untyped values, then simply extract into something that gives you the API you want, like serde_json::Value
which lets you use pointer
and pointer_mut
.
been using configrs for multiple project, and now with a new project writing back to the config file is required.
configs.toml
Was wondering if this crate is able of doing so. Thank you.