diff --git a/src/cursor.rs b/src/cursor.rs index 997b226..5807d6b 100644 --- a/src/cursor.rs +++ b/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> by specifying + // the collection type via the turbofish syntax. assert_eq!(items, cursor.iter().collect::>>().unwrap()); - let retr: Result> = cursor.iter().collect(); + + // Alternately, we can collect it into an appropriately typed variable. + let retr: Result> = cursor.iter_start().collect(); assert_eq!(items, retr.unwrap()); cursor.get(Some(b"key2"), None, MDB_SET).unwrap();