changeset 137:47228aa19ed2

Clarify iterator behavior in trait.
author Lewin Bormann <lbo@spheniscida.de>
date Mon, 02 Jan 2017 11:52:26 +0100
parents 9db0c062d71c
children bd12a967e26e
files src/types.rs
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/types.rs	Mon Jan 02 11:52:13 2017 +0100
+++ b/src/types.rs	Mon Jan 02 11:52:26 2017 +0100
@@ -40,14 +40,15 @@
 
     /// Seek the iterator to `key` or the next bigger key. If the seek is invalid (past last
     /// element), the iterator is reset() and not valid.
+    /// After a seek to an existing key, current() returns that entry.
     fn seek(&mut self, key: &[u8]);
     /// Resets the iterator to be `!valid()` again (before first element)
     fn reset(&mut self);
     /// Returns true if `current()` would return a valid item.
     fn valid(&self) -> bool;
-    /// Return the current item.
+    /// Return the current item (i.e. the item most recently returned by next())
     fn current(&self) -> Option<Self::Item>;
-    /// Go to the previous item.
+    /// Go to the previous item. This is inefficient for most iterators.
     fn prev(&mut self) -> Option<Self::Item>;
 
     fn seek_to_first(&mut self) {