pub fn append<A, B>(&self, txn: &mut RwTxn, key: A, data: B) -> Result<()>
    where
        A: AsRef<[u8]>,
        B: AsRef<[u8]>,
    {
        assert_eq!(self.env_ident, txn.txn.env.env_mut_ptr() as usize);

        let mut key_val = unsafe { crate::into_val(key.as_ref()) };
        let mut data_val = unsafe { crate::into_val(data.as_ref()) };
        let flags = ffi::MDB_APPEND;

        unsafe {
            mdb_result(ffi::mdb_put(txn.txn.txn, self.dbi, &mut key_val, &mut data_val, flags))?
        }

        Ok(())
    }
/// Append the given key/data pair to the end of the database.
///
/// This option allows fast bulk loading when keys are already known to be in the correct order.
/// Loading unsorted keys will cause a MDB_KEYEXIST error.
///
/// ```
/// # 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("append-i32"))?;
///
/// let mut wtxn = env.write_txn()?;
/// # db.clear(&mut wtxn)?;
/// db.put(&mut wtxn, 13_i32.to_be_bytes(), "i-am-thirteen")?;
/// db.put(&mut wtxn, 27_i32.to_be_bytes(), "i-am-twenty-seven")?;
/// db.put(&mut wtxn, 42_i32.to_be_bytes(), "i-am-forty-two")?;
/// db.put(&mut wtxn, 521_i32.to_be_bytes(), "i-am-five-hundred-and-twenty-one")?;
///
/// let ret = db.get(&mut wtxn, 27_i32.to_be_bytes())?;
/// assert_eq!(ret, Some(&b"i-am-twenty-seven"[..]));
///
/// wtxn.commit()?;
/// # Ok(()) }
/// ```
Append the given key/data pair to the end of the database.
This option allows fast bulk loading when keys are already known to be in the correct order.
Loading unsorted keys will cause a MDB_KEYEXIST error.


Append the given key / data pair to the end of the database . This option allows fast bulk loading when keys are already known to be in the correct order . Loading unsorted keys will cause a MDB_KEYEXIST error .
pub fn append<A, B>(&self, txn: &mut RwTxn, key: A, data: B) -> Result<()>
    where
        A: AsRef<[u8]>,
        B: AsRef<[u8]>,
    {
        assert_eq!(self.env_ident, txn.txn.env.env_mut_ptr() as usize);
        let mut key_val = unsafe { crate::into_val(key.as_ref()) };
        let mut data_val = unsafe { crate::into_val(data.as_ref()) };
        let flags = ffi::MDB_APPEND;
        unsafe {
            mdb_result(ffi::mdb_put(txn.txn.txn, self.dbi, &mut key_val, &mut data_val, flags))?
        }
        Ok(())
    }
pub fn append < A , B > ( & self , txn : & mut RwTxn , key : A , data : B ) -> Result < ( ) > where A : AsRef < [ u8 ] > , B : AsRef < [ u8 ] > , { assert_eq ! ( self env_ident txn txn env env_mut_ptr ( ) as usize ) ; let mut key_val = unsafe { crate :: into_val ( key . as_ref ( ) ) } ; let mut data_val = unsafe { crate :: into_val ( data . as_ref ( ) ) } ; let flags = ffi :: MDB_APPEND ; unsafe { mdb_result ( ffi :: mdb_put ( txn . txn . txn , self . dbi , & mut key_val , & mut data_val , flags ) ) ? } Ok ( ( ) ) }
Append the given key/data pair to the end of the database.
Append the given key / data pair to the end of the database .
&self
txn
&mut RwTxn
key
A
data
B
&self
txn
&mut RwTxn
key
A
data
B
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("append-i32"))?.

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