fn create(
        path: &Path,
        configuration: &Configuration,
    ) -> Result<(), Box<dyn std::error::Error>> {
        info!("No configuration file found at {}. Creating a new configuration file with the default configuration.", path.display());
        let toml =
            toml::to_string(configuration).map_err(|source| Error::TomlEncodeError { source })?;

        let mut file = create_file_with_parent_folders(path)
            .map_err(|source| Error::ConfigFileCreationError { source })?;

        file.write_all(&toml.into_bytes())
            .map_err(|source| Error::ConfigFileWriteError { source })?;

        Ok(())
    }
/// Create the configuration file and store the default config into it
Create the configuration file and store the default config into it
Create the configuration file and store the default config into it
fn create(
        path: &Path,
        configuration: &Configuration,
    ) -> Result<(), Box<dyn std::error::Error>> {
        info!("No configuration file found at {}. Creating a new configuration file with the default configuration.", path.display());
        let toml =
            toml::to_string(configuration).map_err(|source| Error::TomlEncodeError { source })?;
        let mut file = create_file_with_parent_folders(path)
            .map_err(|source| Error::ConfigFileCreationError { source })?;
        file.write_all(&toml.into_bytes())
            .map_err(|source| Error::ConfigFileWriteError { source })?;
        Ok(())
    }
fn create ( path : & Path , configuration : & Configuration , ) -> Result < ( ) , Box < dyn std :: error :: Error > > { info ! ( " " path display ( ) ) ; let toml = toml :: to_string ( configuration ) . map_err ( | source | Error :: TomlEncodeError { source } ) ? ; let mut file = create_file_with_parent_folders ( path ) . map_err ( | source | Error :: ConfigFileCreationError { source } ) ? ; file . write_all ( & toml . into_bytes ( ) ) . map_err ( | source | Error :: ConfigFileWriteError { source } ) ? ; Ok ( ( ) ) }
Create the configuration file and store the default config into it
Create the configuration file and store the default config into it
path
&Path
configuration
&Configuration
path
&Path
configuration
&Configuration