Skip to content

Instantly share code, notes, and snippets.

@adamhjk
Created January 12, 2015 18:54
Show Gist options
  • Save adamhjk/353344837ee4067120ec to your computer and use it in GitHub Desktop.
Save adamhjk/353344837ee4067120ec to your computer and use it in GitHub Desktop.
struct Config {
server: Option<String>,
user: Option<String>
}
impl Config {
get(&self, key: &str) -> Result<String, Error> {
match self.get(key) {
Some(v) => return Ok(v),
None => Err(Error{kind: Kind::MissingValue, description: Some(format!("Missing value for {}", key))})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment