pub fn store<'a, T: Serialize>(
app_name: &str,
config_name: impl Into<Option<&'a str>>,
cfg: T
) -> Result<(), ConfyError>
Expand description
Save changes made to a configuration object
This function will update a configuration, with the provided values, and create a new one, if none exists.
You can also use this function to create a new configuration
with different initial values than which are provided
by your Default
trait implementation, or if your
configuration structure can’t implement Default
.
#[derive(Serialize, Deserialize)]
struct MyConf {}
let my_cfg = MyConf {};
confy::store("my-app-name", None, my_cfg)?;
Errors returned are I/O errors related to not being
able to write the configuration file or if confy
encounters an operating system or environment it does
not support.