pub fn last<'txn>(&self, txn: &'txn RoTxn) -> Result<Option<(&'txn [u8], &'txn [u8])>> {
        assert_eq!(self.env_ident, txn.env.env_mut_ptr() as usize);
        let mut cursor = RoCursor::new(txn, self.dbi)?;
        cursor.move_on_last()
    }
/// Retrieves the last key/value pair of this database.
///
/// If the database if empty, then `None` is returned.
///
/// 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("last-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")?;
///
/// let ret = db.last(&wtxn)?;
/// assert_eq!(ret, Some((&42_i32.to_be_bytes()[..], &b"i-am-forty-two"[..])));
///
/// wtxn.commit()?;
/// # Ok(()) }
/// ```
Retrieves the last key/value pair of this database.
If the database if empty, then `None` is returned.

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


Retrieves the last key / value pair of this database . If the database if empty then ` None ` is returned . Comparisons are made by using the bytes representation of the key .
pub fn last<'txn>(&self, txn: &'txn RoTxn) -> Result<Option<(&'txn [u8], &'txn [u8])>> {
        assert_eq!(self.env_ident, txn.env.env_mut_ptr() as usize);
        let mut cursor = RoCursor::new(txn, self.dbi)?;
        cursor.move_on_last()
    }
pub fn last < ' txn > ( & self , txn : & ' txn RoTxn ) -> Result < Option < ( & ' txn [ u8 ] , & ' txn [ u8 ] ) > > { assert_eq ! ( self env_ident txn env env_mut_ptr ( ) as usize ) ; let mut cursor = RoCursor :: new ( txn , self . dbi ) ? ; cursor . move_on_last ( ) }
Retrieves the last key/value pair of this database.
Retrieves the last key / value pair of this database .
&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("last-i32"))?.

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