Skip to content

Commit

Permalink
fix test failure; clarify iterator collection type
Browse files Browse the repository at this point in the history
  • Loading branch information
mykmelez committed Oct 22, 2018
1 parent c3cb55c commit 99f24f7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 99f24f7

Please sign in to comment.