DbTxMut

Trait DbTxMut 

pub trait DbTxMut: Send + Sync {
    type CursorMut<T: Table>: DbCursorRW<T> + DbCursorRO<T> + Send + Sync;
    type DupCursorMut<T: DupSort>: DbDupCursorRW<T> + DbCursorRW<T> + DbDupCursorRO<T> + DbCursorRO<T> + Send + Sync;

    // Required methods
    fn put<T>(
        &self,
        key: <T as Table>::Key,
        value: <T as Table>::Value,
    ) -> Result<(), DatabaseError>
       where T: Table;
    fn delete<T>(
        &self,
        key: <T as Table>::Key,
        value: Option<<T as Table>::Value>,
    ) -> Result<bool, DatabaseError>
       where T: Table;
    fn clear<T>(&self) -> Result<(), DatabaseError>
       where T: Table;
    fn cursor_write<T>(&self) -> Result<Self::CursorMut<T>, DatabaseError>
       where T: Table;
    fn cursor_dup_write<T>(
        &self,
    ) -> Result<Self::DupCursorMut<T>, DatabaseError>
       where T: DupSort;

    // Provided method
    fn append<T>(
        &self,
        key: <T as Table>::Key,
        value: <T as Table>::Value,
    ) -> Result<(), DatabaseError>
       where T: Table { ... }
}
Expand description

Read write transaction that allows writing to database

Required Associated Types§

type CursorMut<T: Table>: DbCursorRW<T> + DbCursorRO<T> + Send + Sync

Read-Write Cursor type

type DupCursorMut<T: DupSort>: DbDupCursorRW<T> + DbCursorRW<T> + DbDupCursorRO<T> + DbCursorRO<T> + Send + Sync

Read-Write DupCursor type

Required Methods§

fn put<T>( &self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>
where T: Table,

Put value to database

fn delete<T>( &self, key: <T as Table>::Key, value: Option<<T as Table>::Value>, ) -> Result<bool, DatabaseError>
where T: Table,

Delete value from database

fn clear<T>(&self) -> Result<(), DatabaseError>
where T: Table,

Clears database.

fn cursor_write<T>(&self) -> Result<Self::CursorMut<T>, DatabaseError>
where T: Table,

Cursor mut

fn cursor_dup_write<T>(&self) -> Result<Self::DupCursorMut<T>, DatabaseError>
where T: DupSort,

DupCursor mut.

Provided Methods§

fn append<T>( &self, key: <T as Table>::Key, value: <T as Table>::Value, ) -> Result<(), DatabaseError>
where T: Table,

Append value with the largest key to database. This should have the same outcome as put, but databases like MDBX provide dedicated modes to make it much faster, typically from O(logN) down to O(1) thanks to no lookup.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl DbTxMut for Tx<RW>

Available on crate feature mdbx only.
§

impl DbTxMut for TxMock