pub fn store<T: Serialize>(name: &str, cfg: T) -> Result<(), ConfyError> {
    let root_name = get_root_name()?;

    let project = ProjectDirs::from("rs", &root_name, name);
    fs::create_dir_all(project.config_dir()).map_err(ConfyError::DirectoryCreationFailed)?;

    let config_dir_str = get_configuration_directory_str(&project)?;

    let path: PathBuf = [config_dir_str, &format!("{}.toml", name)].iter().collect();

    let mut f = OpenOptions::new()
        .write(true)
        .create(true)
        .truncate(true)
        .open(path)
        .map_err(ConfyError::OpenConfigurationFileError)?;
    let s = toml::to_string_pretty(&cfg).map_err(ConfyError::SerializeTomlError)?;
    f.write_all(s.as_bytes())
        .map_err(ConfyError::WriteConfigurationFileError)?;
    Ok(())
}
/// 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`.
///
/// ```rust,no_run
/// # struct MyConf {}
/// 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.
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`.


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 ` .
pub fn store<T: Serialize>(name: &str, cfg: T) -> Result<(), ConfyError> {
    let root_name = get_root_name()?;
    let project = ProjectDirs::from("rs", &root_name, name);
    fs::create_dir_all(project.config_dir()).map_err(ConfyError::DirectoryCreationFailed)?;
    let config_dir_str = get_configuration_directory_str(&project)?;
    let path: PathBuf = [config_dir_str, &format!("{}.toml", name)].iter().collect();
    let mut f = OpenOptions::new()
        .write(true)
        .create(true)
        .truncate(true)
        .open(path)
        .map_err(ConfyError::OpenConfigurationFileError)?;
    let s = toml::to_string_pretty(&cfg).map_err(ConfyError::SerializeTomlError)?;
    f.write_all(s.as_bytes())
        .map_err(ConfyError::WriteConfigurationFileError)?;
    Ok(())
}
pub fn store < T : Serialize > ( name : & str , cfg : T ) -> Result < ( ) , ConfyError > { let root_name = get_root_name ( ) ? ; let project = ProjectDirs :: from ( " " , & root_name , name ) ; fs :: create_dir_all ( project . config_dir ( ) ) . map_err ( ConfyError :: DirectoryCreationFailed ) ? ; let config_dir_str = get_configuration_directory_str ( & project ) ? ; let path : PathBuf = [ config_dir_str , & format ! ( " " name ) ] . iter ( ) . collect ( ) ; let mut f = OpenOptions :: new ( ) . write ( true ) . create ( true ) . truncate ( true ) . open ( path ) . map_err ( ConfyError :: OpenConfigurationFileError ) ? ; let s = toml :: to_string_pretty ( & cfg ) . map_err ( ConfyError :: SerializeTomlError ) ? ; f . write_all ( s . as_bytes ( ) ) . map_err ( ConfyError :: WriteConfigurationFileError ) ? ; Ok ( ( ) ) }
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.
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 .
name
&str
cfg
T
struct myconf {}
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.
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 .