Mercurial > templog
diff rust/src/config.rs @ 611:f3e39e2107fd rust
still doesn't compile, improvements to TemplogError and tokio curl though
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 28 Feb 2017 22:58:47 +0800 |
parents | 8c21df3711e2 |
children | a5721c02d3ee |
line wrap: on
line diff
--- a/rust/src/config.rs Thu Feb 23 23:27:09 2017 +0800 +++ b/rust/src/config.rs Tue Feb 28 22:58:47 2017 +0800 @@ -5,6 +5,8 @@ use std::io::Read; use serde::{Serialize,Deserialize,Deserializer,Serializer}; +use types::*; + #[derive(Deserialize,Serialize,Debug,Clone)] #[allow(non_snake_case)] pub struct Config { @@ -69,7 +71,7 @@ toml::to_string(self).unwrap() } - pub fn merge(&self, conf: &str) -> Result<Self, Box<Error>> { + pub fn merge(&self, conf: &str) -> Result<Self, TemplogError> { // convert existing and new toml into tables, combine them. let mut new_toml = toml::from_str(conf)?; let mut ex_val = toml::Value::try_from(self).unwrap(); @@ -80,7 +82,7 @@ Ok(ret) } - pub fn merge_file(&self, filename: &str) -> Result<Self, Box<Error>> { + pub fn merge_file(&self, filename: &str) -> Result<Self, TemplogError> { let mut s = String::new(); File::open(filename)?.read_to_string(&mut s)?;