[][src]Struct sanakirja::MutTxn

pub struct MutTxn<'env, T> { /* fields omitted */ }

A mutable transaction.

Methods

impl<'env, T> MutTxn<'env, T>[src]

pub fn mut_txn_begin<'txn>(
    &'txn mut self
) -> Result<MutTxn<'env, &'txn mut MutTxn<'env, T>>, Error>
[src]

Start a mutable transaction.

impl<'env, T> MutTxn<'env, T>[src]

pub fn put<R: Rng, K: Representable, V: Representable>(
    &mut self,
    rng: &mut R,
    db: &mut Db<K, V>,
    key: K,
    value: V
) -> Result<bool, Error>
[src]

Insert a binding to a database, returning false if and only if the exact same binding (key and value) was already in the database.

impl<'env, T> MutTxn<'env, T>[src]

pub fn del<R: Rng, K: Representable, V: Representable>(
    &mut self,
    rng: &mut R,
    db: &mut Db<K, V>,
    key: K,
    value: Option<V>
) -> Result<bool, Error>
[src]

If value is None, delete one of the bindings associated to key from the database (without any specific preference). Else, delete the specified binding if present.

impl<'env, T> MutTxn<'env, T>[src]

pub fn create_db<K: Representable, V: Representable>(
    &mut self
) -> Result<Db<K, V>, Error>
[src]

Creates a new database, complexity O(1).

pub fn set_root<K: Representable, V: Representable>(
    &mut self,
    root: usize,
    value: Db<K, V>
)
[src]

Sets the specified root to the given value. At most 508 different roots are allowed.

pub fn fork<R: Rng, K: Representable, V: Representable>(
    &mut self,
    rng: &mut R,
    db: &Db<K, V>
) -> Result<Db<K, V>, Error>
[src]

Fork a database, in O(log n), where n is the number of pages with reference count at least 2 (this complexity is also O(log |db|)).

pub fn drop<R: Rng, K: Representable, V: Representable>(
    &mut self,
    rng: &mut R,
    db: &Db<K, V>
) -> Result<(), Error>
[src]

Drop a database, in O(n).

Trait Implementations

impl<'a, 'env, T> Commit for MutTxn<'env, &'a mut MutTxn<'env, T>>[src]

impl<'env> Commit for MutTxn<'env, ()>[src]

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

Commit a transaction. This is guaranteed to be atomic: either the commit succeeds, and all the changes made during the transaction are written to disk. Or the commit doesn't succeed, and we're back to the state just before starting the transaction.

impl<'env, T> Transaction for MutTxn<'env, T>[src]

Important traits for DbIterator<'a, T, K, V>
fn iter<'a, K: Representable, V: Representable>(
    &'a self,
    db: &'a Db<K, V>,
    key: Option<(K, Option<V>)>
) -> DbIterator<'a, Self, K, V>
[src]

Iterate over a database, starting at the first value larger than or equal to (key, value) (and at the smallest key, or smallest value if one or both of them is None). Read more

Important traits for RevDbIterator<'a, T, K, V>
fn rev_iter<'a, K: Representable, V: Representable>(
    &'a self,
    db: &'a Db<K, V>,
    key: Option<(K, Option<V>)>
) -> RevDbIterator<'a, Self, K, V>
[src]

Iterate over a database in the reverse order, starting from the last binding strictly before k (or from the last binding in the table if k.is_none()).

fn set_cursors<K: Representable, V: Representable>(
    &self,
    root: &Db<K, V>,
    key: Option<(K, Option<V>)>
) -> (Cursor, bool)
[src]

Create a cursor positionned just before key.

fn root<K: Representable, V: Representable>(
    &self,
    root: usize
) -> Option<Db<K, V>>
[src]

Gets the specified root. At most 508 different roots are allowed.

fn get<'a, K: Representable, V: Representable>(
    &'a self,
    root: &Db<K, V>,
    key: K,
    value: Option<V>
) -> Option<V>
[src]

Get the smallest value associated to key, or returns the given binding if value is Some(..) and is associated to key in the given database. Read more

impl<'env, T> Drop for MutTxn<'env, T>[src]

Auto Trait Implementations

impl<'env, T> !Send for MutTxn<'env, T>

impl<'env, T> Unpin for MutTxn<'env, T> where
    T: Unpin

impl<'env, T> !Sync for MutTxn<'env, T>

impl<'env, T> !UnwindSafe for MutTxn<'env, T>

impl<'env, T> !RefUnwindSafe for MutTxn<'env, T>

Blanket Implementations

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.

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

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

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