pub fn load_from_toml(file: &str) -> Result<Self> {
        let txt = std::fs::read_to_string(file)
            .map_err(|e| ErrorCode::ConfigError(format!("File: {}, err: {:?}", file, e)))?;

        let cfg = toml::from_str::<Config>(txt.as_str())
            .map_err(|e| ErrorCode::ConfigError(format!("{:?}", e)))?;

        cfg.check()?;
        Ok(cfg)
    }
/// Load configs from toml file.
Load configs from toml file.
Load configs from toml file .
pub fn load_from_toml(file: &str) -> Result<Self> {
        let txt = std::fs::read_to_string(file)
            .map_err(|e| ErrorCode::ConfigError(format!("File: {}, err: {:?}", file, e)))?;
        let cfg = toml::from_str::<Config>(txt.as_str())
            .map_err(|e| ErrorCode::ConfigError(format!("{:?}", e)))?;
        cfg.check()?;
        Ok(cfg)
    }
pub fn load_from_toml ( file : & str ) -> Result < Self > { let txt = std :: fs :: read_to_string ( file ) . map_err ( | e | ErrorCode :: ConfigError ( format ! ( " " file e ) ) ) ? ; let cfg = toml :: from_str :: < Config > ( txt . as_str ( ) ) . map_err ( | e | ErrorCode :: ConfigError ( format ! ( " " e ) ) ) ? ; cfg . check ( ) ? ; Ok ( cfg ) }
Load configs from toml file.
Load configs from toml file .
file
&str
file
&str