pub struct WriteTransaction<'env>(/* private fields */);
Implementations§
Source§impl<'env> WriteTransaction<'env>
impl<'env> WriteTransaction<'env>
pub fn new(env: &'env Environment) -> Self
pub fn get<K, V>(&self, db: &Database<'_>, key: &K) -> Option<V>
Sourcepub fn put_reserve<K, V>(&mut self, db: &Database<'_>, key: &K, value: &V)
pub fn put_reserve<K, V>(&mut self, db: &Database<'_>, key: &K, value: &V)
Puts a key/value pair into the database by copying it into a reserved space in the database. This works best for values that need to be serialised into the reserved space. This method will panic when called on a database with duplicate keys!
Sourcepub fn put<K, V>(&mut self, db: &Database<'_>, key: &K, value: &V)
pub fn put<K, V>(&mut self, db: &Database<'_>, key: &K, value: &V)
Puts a key/value pair into the database by passing a reference to a byte slice.
This is more efficient than put_reserve
if no serialisation is needed,
and the existing value can be immediately written into the database.
This also works with duplicate key databases.
pub fn remove<K>(&mut self, db: &Database<'_>, key: &K)where
K: AsDatabaseBytes + ?Sized,
pub fn remove_item<K, V>(&mut self, db: &Database<'_>, key: &K, value: &V)
pub fn commit(self)
pub fn abort(self)
pub fn cursor<'txn, 'db>( &'txn self, db: &'db Database<'env>, ) -> Cursor<'txn, 'db>
Methods from Deref<Target = Transaction<'env>>§
Trait Implementations§
Source§impl<'env> Debug for WriteTransaction<'env>
impl<'env> Debug for WriteTransaction<'env>
Source§impl<'env> Deref for WriteTransaction<'env>
impl<'env> Deref for WriteTransaction<'env>
Source§type Target = Transaction<'env>
type Target = Transaction<'env>
The resulting type after dereferencing.
Source§fn deref(&self) -> &Transaction<'env>
fn deref(&self) -> &Transaction<'env>
Dereferences the value.
Auto Trait Implementations§
impl<'env> !Freeze for WriteTransaction<'env>
impl<'env> !RefUnwindSafe for WriteTransaction<'env>
impl<'env> !Send for WriteTransaction<'env>
impl<'env> !Sync for WriteTransaction<'env>
impl<'env> Unpin for WriteTransaction<'env>
impl<'env> !UnwindSafe for WriteTransaction<'env>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more