Trait Atomic

Source
pub trait Atomic: ByteStore {
    // Required methods
    fn atomic_update(
        &self,
        key: &[u8],
        op: impl FnMut(Option<&[u8]>) -> Option<Vec<u8>>,
    ) -> Result<(), Self::DbError>;
    fn conditional_update(
        &self,
        key: &[u8],
        new: &[u8],
        expected: &[u8],
    ) -> Result<(), Self::DbError>;
}
Expand description

A helper trait, implementing this automatically implements data_store::Atomic

Required Methods§

Source

fn atomic_update( &self, key: &[u8], op: impl FnMut(Option<&[u8]>) -> Option<Vec<u8>>, ) -> Result<(), Self::DbError>

returns the old value

Source

fn conditional_update( &self, key: &[u8], new: &[u8], expected: &[u8], ) -> Result<(), Self::DbError>

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.

Implementations on Foreign Types§

Source§

impl Atomic for Tree

Source§

fn atomic_update( &self, key: &[u8], op: impl FnMut(Option<&[u8]>) -> Option<Vec<u8>>, ) -> Result<(), Self::DbError>

Source§

fn conditional_update( &self, key: &[u8], new: &[u8], expected: &[u8], ) -> Result<(), Self::DbError>

Implementors§