// parse config struct from a file
parse config struct from a file
parse config struct from a file
pub fn from_config_file(file_path: &str) -> Result<Self> {
        match fs::read_to_string(file_path) {
            // if cannot open the file, use the default configurations
            Err(err) => {
                warn!(
                    "failed to open {}: {:#?}\n...Use the default configurations instead",
                    file_path, err
                );
                Ok(Self::default())
            }
            Ok(config_str) => Ok(toml::from_str(&config_str)?),
        }
    }
pub fn from_config_file ( file_path : & str ) -> Result < Self > { match fs :: read_to_string ( file_path ) { // if cannot open the file, use the default configurations Err ( err ) => { warn ! ( " \n " file_path err ) ; Ok ( Self :: default ( ) ) } Ok ( config_str ) => Ok ( toml :: from_str ( & config_str ) ? ) , } }
parse config struct from a file
parse config struct from a file
file_path
&str