Commit 466c776b authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub

Merge pull request #10 from kaedroho/feature/serde

Migrate to serde. Fixes #9
parents b3849ddf 520c140d
...@@ -4,5 +4,6 @@ version = "0.1.0" ...@@ -4,5 +4,6 @@ version = "0.1.0"
[dependencies] [dependencies]
redox_syscall = "0.1" redox_syscall = "0.1"
rustc-serialize = "0.3" serde = "1.0"
toml = "0.2" serde_derive = "1.0"
toml = "0.4"
#[derive(Debug, Default, RustcDecodable)] #[derive(Debug, Default, Deserialize)]
pub struct Config { pub struct Config {
pub drivers: Vec<DriverConfig> pub drivers: Vec<DriverConfig>
} }
#[derive(Debug, Default, RustcDecodable)] #[derive(Debug, Default, Deserialize)]
pub struct DriverConfig { pub struct DriverConfig {
pub name: Option<String>, pub name: Option<String>,
pub class: Option<u8>, pub class: Option<u8>,
......
#![deny(warnings)] #![deny(warnings)]
#![feature(asm)] #![feature(asm)]
extern crate rustc_serialize; extern crate serde;
#[macro_use] extern crate serde_derive;
extern crate syscall; extern crate syscall;
extern crate toml; extern crate toml;
...@@ -25,7 +26,7 @@ fn main() { ...@@ -25,7 +26,7 @@ fn main() {
if let Ok(mut config_file) = File::open(&config_path) { if let Ok(mut config_file) = File::open(&config_path) {
let mut config_data = String::new(); let mut config_data = String::new();
if let Ok(_) = config_file.read_to_string(&mut config_data) { if let Ok(_) = config_file.read_to_string(&mut config_data) {
config = toml::decode_str(&config_data).unwrap_or(Config::default()); config = toml::from_str(&config_data).unwrap_or(Config::default());
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment