pub fn put<'txn>(
        &'txn self,
        db: &Database<'txn>,
        key: impl AsRef<[u8]>,
        data: impl AsRef<[u8]>,
        flags: WriteFlags,
    ) -> Result<()> {
        let key = key.as_ref();
        let data = data.as_ref();
        let key_val: ffi::MDBX_val = ffi::MDBX_val {
            iov_len: key.len(),
            iov_base: key.as_ptr() as *mut c_void,
        };
        let mut data_val: ffi::MDBX_val = ffi::MDBX_val {
            iov_len: data.len(),
            iov_base: data.as_ptr() as *mut c_void,
        };
        mdbx_result(txn_execute(&self.txn, |txn| unsafe {
            ffi::mdbx_put(txn, db.dbi(), &key_val, &mut data_val, c_enum(flags.bits()))
        }))?;

        Ok(())
    }
/// Stores an item into a database.
///
/// This function stores key/data pairs in the database. The default
/// behavior is to enter the new key/data pair, replacing any previously
/// existing key if duplicates are disallowed, or adding a duplicate data
/// item if duplicates are allowed ([DatabaseFlags::DUP_SORT]).
Stores an item into a database.
This function stores key/data pairs in the database. The default
behavior is to enter the new key/data pair, replacing any previously
existing key if duplicates are disallowed, or adding a duplicate data
item if duplicates are allowed ([DatabaseFlags::DUP_SORT]).
Stores an item into a database . This function stores key / data pairs in the database . The default behavior is to enter the new key / data pair replacing any previously existing key if duplicates are disallowed or adding a duplicate data item if duplicates are allowed ( [ DatabaseFlags :: DUP_SORT ] ) .
pub fn put<'txn>(
        &'txn self,
        db: &Database<'txn>,
        key: impl AsRef<[u8]>,
        data: impl AsRef<[u8]>,
        flags: WriteFlags,
    ) -> Result<()> {
        let key = key.as_ref();
        let data = data.as_ref();
        let key_val: ffi::MDBX_val = ffi::MDBX_val {
            iov_len: key.len(),
            iov_base: key.as_ptr() as *mut c_void,
        };
        let mut data_val: ffi::MDBX_val = ffi::MDBX_val {
            iov_len: data.len(),
            iov_base: data.as_ptr() as *mut c_void,
        };
        mdbx_result(txn_execute(&self.txn, |txn| unsafe {
            ffi::mdbx_put(txn, db.dbi(), &key_val, &mut data_val, c_enum(flags.bits()))
        }))?;
        Ok(())
    }
pub fn put < ' txn > ( & ' txn self , db : & Database < ' txn > , key : impl AsRef < [ u8 ] > , data : impl AsRef < [ u8 ] > , flags : WriteFlags , ) -> Result < ( ) > { let key = key . as_ref ( ) ; let data = data . as_ref ( ) ; let key_val : ffi :: MDBX_val = ffi :: MDBX_val { iov_len : key . len ( ) , iov_base : key . as_ptr ( ) as * mut c_void , } ; let mut data_val : ffi :: MDBX_val = ffi :: MDBX_val { iov_len : data . len ( ) , iov_base : data . as_ptr ( ) as * mut c_void , } ; mdbx_result ( txn_execute ( & self . txn , | txn | unsafe { ffi :: mdbx_put ( txn , db . dbi ( ) , & key_val , & mut data_val , c_enum ( flags . bits ( ) ) ) } ) ) ? ; Ok ( ( ) ) }
Stores an item into a database.
Stores an item into a database .
&'txn self
db
&Database<'txn>
key
impl AsRef<[u8]>
data
impl AsRef<[u8]>
flags
WriteFlags