Function confy::store

source ·
pub fn store<T: Serialize>(name: &str, cfg: T) -> Result<(), IoError>
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.

let my_cfg = MyConf {};
confy::store(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.