Skip to content

Instantly share code, notes, and snippets.

@silen-z
Created December 20, 2020 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silen-z/8abe281dc7193b04ba93021afb0e16c4 to your computer and use it in GitHub Desktop.
Save silen-z/8abe281dc7193b04ba93021afb0e16c4 to your computer and use it in GitHub Desktop.
maping and collecting an iterator
let values: Vec<Interface> = rkv
.store
.iter_start(&reader)
.unwrap()
.map(|value| match value {
Ok((_, Value::Str(serialized))) => {
let data: Interface = serde_json::from_str(serialized).unwrap();
data
}
_ => panic!(),
})
.collect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment