Struct WriteTransaction

Source
pub struct WriteTransaction<'env>(/* private fields */);

Implementations§

Source§

impl<'env> WriteTransaction<'env>

Source

pub fn new(env: &'env Environment) -> Self

Source

pub fn get<K, V>(&self, db: &Database<'_>, key: &K) -> Option<V>

Source

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!

Source

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.

Source

pub fn remove<K>(&mut self, db: &Database<'_>, key: &K)
where K: AsDatabaseBytes + ?Sized,

Source

pub fn remove_item<K, V>(&mut self, db: &Database<'_>, key: &K, value: &V)

Source

pub fn commit(self)

Source

pub fn abort(self)

Source

pub fn cursor<'txn, 'db>( &'txn self, db: &'db Database<'env>, ) -> Cursor<'txn, 'db>

Methods from Deref<Target = Transaction<'env>>§

Source

pub fn get<K, V>(&self, db: &Database<'_>, key: &K) -> Option<V>

Source

pub fn cursor<'txn, 'db>( &'txn self, db: &'db Database<'env>, ) -> Cursor<'txn, 'db>

Trait Implementations§

Source§

impl<'env> Debug for WriteTransaction<'env>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'env> Deref for WriteTransaction<'env>

Source§

type Target = Transaction<'env>

The resulting type after dereferencing.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> SafeBorrow<T> for T
where T: ?Sized,

Source§

fn borrow_replacement(ptr: &T) -> &T

Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Erased for T