pub fn is_empty<'txn>(&self, txn: &'txn RoTxn) -> Result<bool> {
        assert_eq!(self.env_ident, txn.env.env_mut_ptr() as usize);

        let mut cursor = RoCursor::new(txn, self.dbi)?;
        match cursor.move_on_first()? {
            Some(_) => Ok(false),
            None => Ok(true),
        }
    }
/// Returns `true` if and only if this database is empty.
///
/// ```
/// # 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, 42_i32.to_be_bytes(), "i-am-forty-two")?;
/// db.put(&mut wtxn, 27_i32.to_be_bytes(), "i-am-twenty-seven")?;
/// db.put(&mut wtxn, 13_i32.to_be_bytes(), "i-am-thirteen")?;
/// db.put(&mut wtxn, 521_i32.to_be_bytes(), "i-am-five-hundred-and-twenty-one")?;
///
/// let ret = db.is_empty(&wtxn)?;
/// assert_eq!(ret, false);
///
/// db.clear(&mut wtxn)?;
///
/// let ret = db.is_empty(&wtxn)?;
/// assert_eq!(ret, true);
///
/// wtxn.commit()?;
/// # Ok(()) }
/// ```
Returns `true` if and only if this database is empty.
Returns ` true ` if and only if this database is empty .
pub fn is_empty<'txn>(&self, txn: &'txn RoTxn) -> Result<bool> {
        assert_eq!(self.env_ident, txn.env.env_mut_ptr() as usize);
        let mut cursor = RoCursor::new(txn, self.dbi)?;
        match cursor.move_on_first()? {
            Some(_) => Ok(false),
            None => Ok(true),
        }
    }
pub fn is_empty < ' txn > ( & self , txn : & ' txn RoTxn ) -> Result < bool > { assert_eq ! ( self env_ident txn env env_mut_ptr ( ) as usize ) ; let mut cursor = RoCursor :: new ( txn , self . dbi ) ? ; match cursor . move_on_first ( ) ? { Some ( _ ) => Ok ( false ) , None => Ok ( true ) , } }
Returns `true` if and only if this database is empty.
Returns ` true ` if and only if this database is empty .
&self
txn
&'txn RoTxn
&self
txn
&'txn RoTxn
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)?;


let ret = db.is_empty(&wtxn)?;
assert_eq!(ret, false).

db.clear(&mut wtxn)?.

let ret = db.is_empty(&wtxn)?;
assert_eq!(ret, true).

wtxn.commit()?.
let ret = db . is_empty ( &wtxn ) ? ; assert_eq! ( ret false ) . db . clear ( &mut wtxn ) ? . let ret = db . is_empty ( &wtxn ) ? ; assert_eq! ( ret true ) . wtxn . commit () ? .
ok(()) }
None