Simplifies slightly the iteration code

pull/22/head
Tpt 5 years ago
parent e0bbe29dc2
commit 1bd91f6797
  1. 10
      lib/src/store/rocksdb.rs

@ -640,16 +640,14 @@ impl<'a, F: Fn(&[u8]) -> Result<EncodedQuad>> Iterator for DecodingIndexIterator
type Item = Result<EncodedQuad>; type Item = Result<EncodedQuad>;
fn next(&mut self) -> Option<Result<EncodedQuad>> { fn next(&mut self) -> Option<Result<EncodedQuad>> {
if self.iter.valid() { if let Some(key) = self.iter.key() {
let result = self.iter.key().and_then(|key| {
if key.starts_with(&self.prefix) { if key.starts_with(&self.prefix) {
Some((self.decode)(key)) let result = (self.decode)(key);
self.iter.next();
Some(result)
} else { } else {
None None
} }
});
self.iter.next();
result
} else { } else {
None None
} }

Loading…
Cancel
Save