From 99f24f745d9506ea8ecf0b8012dc20d5d5b14ed9 Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Mon, 22 Oct 2018 11:28:32 -0700 Subject: [PATCH] fix test failure; clarify iterator collection type --- src/cursor.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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();