pub struct Cursor { /* private fields */ }Implementations§
Source§impl Cursor
impl Cursor
Sourcepub fn next(&mut self) -> Result<(Option<DBT<'_>>, Option<DBT<'_>>), Error>
pub fn next(&mut self) -> Result<(Option<DBT<'_>>, Option<DBT<'_>>), Error>
Iterate over key/data pairs in the database.
§Examples
use libdb::Flags;
// Note: BDB requires that the key and value be mutable.
let mut key = String::from("key").into_bytes();
let mut value = String::from("value").into_bytes();
let ret = db.put(None, key.as_mut_slice(), value.as_mut_slice(), Flags::DB_NONE);
assert!(ret.is_ok());
// get cursor and iterate
let mut cursor = db.cursor().expect("Failed to get cursor");
let (key_dbt, data_dbt) = cursor.next().expect("Could not walk cursor");
assert_eq!("key", str::from_utf8(key_dbt.unwrap().as_slice()).unwrap());
assert_eq!("value", str::from_utf8(data_dbt.unwrap().as_slice()).unwrap());Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl !Send for Cursor
impl !Sync for Cursor
impl Unpin for Cursor
impl UnwindSafe for Cursor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more