config.rs 337 B

1234567891011121314
  1. use std::fs::File;
  2. use std::io::prelude::*;
  3. use toml;
  4. pub type Config = toml::Value;
  5. pub fn load(path: &str) -> Config {
  6. let mut text = String::new();
  7. let mut f = File::open(path).unwrap();
  8. f.read_to_string(&mut text).ok().expect("Failed to load config");
  9. let value = text.parse::<toml::Value>().unwrap();
  10. value
  11. }