fix test failure; clarify iterator collection type

without.crypto
Myk Melez 6 years ago
parent c3cb55c825
commit 99f24f745d
  1. 7
      src/cursor.rs

@ -434,8 +434,13 @@ mod test {
let txn = env.begin_ro_txn().unwrap();
let mut cursor = txn.open_ro_cursor(db).unwrap();
// Because Result implements FromIterator, we can collect the iterator
// of items of type Result<_, E> into a Result<Vec<_, E>> by specifying
// the collection type via the turbofish syntax.
assert_eq!(items, cursor.iter().collect::<Result<Vec<_>>>().unwrap());
let retr: Result<Vec<_>> = cursor.iter().collect();
// Alternately, we can collect it into an appropriately typed variable.
let retr: Result<Vec<_>> = cursor.iter_start().collect();
assert_eq!(items, retr.unwrap());
cursor.get(Some(b"key2"), None, MDB_SET).unwrap();

Loading…
Cancel
Save