pub fn load_config() -> Result<Config, Error> {
        let mut file = Config::load_or_create_config_file()?;

        let mut buf = vec![];
        file.read_to_end(&mut buf)?;
        let toml_str = from_utf8(&buf)?;

        let config: Config = if toml_str.is_empty() {
            let config = Config::default();
            let toml_str = toml::to_string(&config).unwrap();
            file.write_all(toml_str.as_bytes())?;

            config
        } else {
            toml::from_str(toml_str)?
        };

        Ok(config)
    }
/// Read the file in which the setting file is described.
/// If not, create it
Read the file in which the setting file is described.
If not, create it
Read the file in which the setting file is described . If not create it
pub fn load_config() -> Result<Config, Error> {
        let mut file = Config::load_or_create_config_file()?;
        let mut buf = vec![];
        file.read_to_end(&mut buf)?;
        let toml_str = from_utf8(&buf)?;
        let config: Config = if toml_str.is_empty() {
            let config = Config::default();
            let toml_str = toml::to_string(&config).unwrap();
            file.write_all(toml_str.as_bytes())?;
            config
        } else {
            toml::from_str(toml_str)?
        };
        Ok(config)
    }
pub fn load_config ( ) -> Result < Config , Error > { let mut file = Config :: load_or_create_config_file ( ) ? ; let mut buf = vec ! [ ] ; file . read_to_end ( & mut buf ) ? ; let toml_str = from_utf8 ( & buf ) ? ; let config : Config = if toml_str . is_empty ( ) { let config = Config :: default ( ) ; let toml_str = toml :: to_string ( & config ) . unwrap ( ) ; file . write_all ( toml_str . as_bytes ( ) ) ? ; config } else { toml :: from_str ( toml_str ) ? } ; Ok ( config ) }
Read the file in which the setting file is described.
Read the file in which the setting file is described .