[][src]Enum kv::Txn

pub enum Txn<'env> {
    ReadOnly(RoTransaction<'env>),
    ReadWrite(RwTransaction<'env>),
}

Access to the database

Variants

ReadOnly(RoTransaction<'env>)

Readonly access

ReadWrite(RwTransaction<'env>)

Read-write access

Methods

impl<'env> Txn<'env>[src]

pub fn is_read_only(&self) -> bool[src]

Returns true when the transaction is ReadOnly

pub fn commit(self) -> Result<(), Error>[src]

Ends the transaction, saving all changes

pub fn abort(self)[src]

Ends the transaction, discarding all changes

pub fn get<K: Key, V: Value<'env>>(
    &'env self,
    bucket: &Bucket<'env, K, V>,
    key: K
) -> Result<V, Error>
[src]

Gets the value associated with the given key

pub fn set<K: Key, V: Value<'env>, X: Into<V>>(
    &mut self,
    bucket: &Bucket<'env, K, V>,
    key: K,
    val: X
) -> Result<(), Error>
[src]

Sets the value associated with the given key

pub fn set_no_overwrite<K: Key, V: Value<'env>, X: Into<V>>(
    &mut self,
    bucket: &Bucket<'env, K, V>,
    key: K,
    val: X
) -> Result<(), Error>
[src]

Sets the value associated with the given key if it doesn't already exist

pub fn del<K: Key, V: Value<'env>>(
    &mut self,
    bucket: &Bucket<'env, K, V>,
    key: K
) -> Result<(), Error>
[src]

Deletes the key and value associated with key from the database

pub fn clear_db<K: Key, V: Value<'env>>(
    &mut self,
    bucket: &Bucket<'env, K, V>
) -> Result<(), Error>
[src]

Remove all items from the database

pub fn reserve<K: Key, V: Value<'env>>(
    &'env mut self,
    bucket: &Bucket<'env, K, V>,
    key: K,
    len: usize
) -> Result<ValueMut<'env>, Error>
[src]

Reserve a buffer

pub fn reserve_no_overwrite<K: Key, V: Value<'env>>(
    &'env mut self,
    bucket: &Bucket<'env, K, V>,
    key: K,
    len: usize
) -> Result<ValueMut<'env>, Error>
[src]

Reserve a buffer with a unique key

pub fn read_cursor<K: Key, V: Value<'env>>(
    &'env self,
    bucket: &Bucket<'env, K, V>
) -> Result<Cursor<'env, K, V>, Error>
[src]

Open a new readonly cursor

pub fn write_cursor<K: Key, V: Value<'env>>(
    &'env mut self,
    bucket: &Bucket<'env, K, V>
) -> Result<Cursor<'env, K, V>, Error>
[src]

Open a new writable cursor

pub fn txn(&mut self) -> Result<Txn, Error>[src]

Open a nested transaction NOTE: you must alread be in a read/write transaction otherwise an error will be returned

Auto Trait Implementations

impl<'env> RefUnwindSafe for Txn<'env>

impl<'env> !Send for Txn<'env>

impl<'env> !Sync for Txn<'env>

impl<'env> Unpin for Txn<'env>

impl<'env> UnwindSafe for Txn<'env>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.