Function wd_run::load_config [−][src]
pub fn load_config<T: for<'a> Deserialize<'a>>(
path: impl AsRef<Path>
) -> Result<T, String>
Expand description
load config file to struct supported formats [x] yaml [x] json [x] toml [x] http
example
#[derive(Debug, Deserialize)]
pub struct Config {
pub log: i32,
pub server: String,
pub stream: String,
}
let conf:Config = load_config("./src/util/conf/config.toml").unwrap();
println!("{:?}",conf)