Skip to content

Instantly share code, notes, and snippets.

@kejadlen
Created April 26, 2016 16:13
Show Gist options
  • Save kejadlen/a769616b014dbcc1b00e6793195fb8b7 to your computer and use it in GitHub Desktop.
Save kejadlen/a769616b014dbcc1b00e6793195fb8b7 to your computer and use it in GitHub Desktop.
let authors = match config["authors"].as_hash() {
Some(v) => {
v.iter()
.filter_map(|(k, v)| {
vec![k.as_str(), v.as_str()]
.into_iter()
.collect::<Option<Vec<_>>>()
})
.map(|v| (v[0].into(), v[1].into()))
.collect::<HashMap<_, _>>()
}
None => HashMap::new(),
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment