pub fn prefix_iter<'txn, A: AsRef<[u8]>>(
        &self,
        txn: &'txn RoTxn,
        prefix: A,
    ) -> Result<RoPrefix<'txn>> {
        assert_eq!(self.env_ident, txn.env.env_mut_ptr() as usize);
        RoCursor::new(txn, self.dbi).map(|cursor| RoPrefix::new(cursor, prefix.as_ref().to_vec()))
    }
/// Return a lexicographically ordered iterator of all key-value pairs
/// in this database that starts with the given prefix.
///
/// Comparisons are made by using the bytes representation of the key.
///
/// ```
/// # use std::fs;
/// # use std::path::Path;
/// # use smolheed::EnvOpenOptions;
/// use smolheed::Database;
///
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// # fs::create_dir_all(Path::new("target").join("zerocopy.mdb"))?;
/// # let env = EnvOpenOptions::new()
/// #     .map_size(10 * 1024 * 1024) // 10MB
/// #     .max_dbs(3000)
/// #     .open(Path::new("target").join("zerocopy.mdb"))?;
///
/// let db = env.create_database(Some("iter-i32"))?;
///
/// let mut wtxn = env.write_txn()?;
/// # db.clear(&mut wtxn)?;
/// db.put(&mut wtxn, "i-am-twenty-eight", 28_i32.to_be_bytes())?;
/// db.put(&mut wtxn, "i-am-twenty-seven", 27_i32.to_be_bytes())?;
/// db.put(&mut wtxn, "i-am-twenty-nine", 29_i32.to_be_bytes())?;
/// db.put(&mut wtxn, "i-am-forty-one", 41_i32.to_be_bytes())?;
/// db.put(&mut wtxn, "i-am-forty-two", 42_i32.to_be_bytes())?;
///
/// let mut iter = db.prefix_iter(&mut wtxn, "i-am-twenty")?;
/// assert_eq!(iter.next().transpose()?, Some((&b"i-am-twenty-eight"[..], &28_i32.to_be_bytes()[..])));
/// assert_eq!(iter.next().transpose()?, Some((&b"i-am-twenty-nine"[..], &29_i32.to_be_bytes()[..])));
/// assert_eq!(iter.next().transpose()?, Some((&b"i-am-twenty-seven"[..], &27_i32.to_be_bytes()[..])));
/// assert_eq!(iter.next().transpose()?, None);
///
/// drop(iter);
/// wtxn.commit()?;
/// # Ok(()) }
/// ```
Return a lexicographically ordered iterator of all key-value pairs
in this database that starts with the given prefix.

Comparisons are made by using the bytes representation of the key.


Return a lexicographically ordered iterator of all key - value pairs in this database that starts with the given prefix . Comparisons are made by using the bytes representation of the key .
pub fn prefix_iter<'txn, A: AsRef<[u8]>>(
        &self,
        txn: &'txn RoTxn,
        prefix: A,
    ) -> Result<RoPrefix<'txn>> {
        assert_eq!(self.env_ident, txn.env.env_mut_ptr() as usize);
        RoCursor::new(txn, self.dbi).map(|cursor| RoPrefix::new(cursor, prefix.as_ref().to_vec()))
    }
pub fn prefix_iter < ' txn , A : AsRef < [ u8 ] > > ( & self , txn : & ' txn RoTxn , prefix : A , ) -> Result < RoPrefix < ' txn > > { assert_eq ! ( self env_ident txn env env_mut_ptr ( ) as usize ) ; RoCursor :: new ( txn , self . dbi ) . map ( | cursor | RoPrefix :: new ( cursor , prefix . as_ref ( ) . to_vec ( ) ) ) }
Return a lexicographically ordered iterator of all key-value pairs
in this database that starts with the given prefix.
Return a lexicographically ordered iterator of all key - value pairs in this database that starts with the given prefix .
&self
txn
&'txn RoTxn
prefix
A
&self
txn
&'txn RoTxn
prefix
A
use std::fs;
None
use std::path::path;
None
use smolheed::envopenoptions;
None
fn main() -> result<(), box<dyn std::error::error>> {
None
fs::create_dir_all(path::new("target").join("zerocopy.mdb"))?;
None
let env = envopenoptions::new()
None
.map_size(10 * 1024 * 1024) // 10mb
None
.max_dbs(3000)
None
.open(path::new("target").join("zerocopy.mdb"))?;
let db = env.create_database(Some("iter-i32"))?.

let mut wtxn = env.write_txn()?.
let db = env . create_database ( Some ( " iter - i32 " )) ? . let mut wtxn = env . write_txn () ? .
db.clear(&mut wtxn)?;
None
ok(()) }
None