Skip to main content

OptionalTransaction

Trait OptionalTransaction 

Source
pub trait OptionalTransaction<'db, 'txn> {
    // Required method
    fn or_new<'inner>(
        self,
        db: &'inner MdbxDatabase,
    ) -> TransactionProxy<'db, 'txn>
       where 'db: 'txn,
             'inner: 'db;
}
Expand description

A helper trait that is implemented on Option<&T> with T: AsRef<MdbxReadTransaction<'db>>. It allows to use the existing transaction or create a new one. Example: let txn = opt_txn.or_new(db);

Required Methods§

Source

fn or_new<'inner>(self, db: &'inner MdbxDatabase) -> TransactionProxy<'db, 'txn>
where 'db: 'txn, 'inner: 'db,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'db, 'txn, T: AsRef<MdbxReadTransaction<'db>>> OptionalTransaction<'db, 'txn> for Option<&'txn T>

Source§

fn or_new<'inner>(self, db: &'inner MdbxDatabase) -> TransactionProxy<'db, 'txn>
where 'db: 'txn, 'inner: 'db,

Implementors§