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§
Sourcefn atomic_update(
&self,
key: &[u8],
op: impl FnMut(Option<&[u8]>) -> Option<Vec<u8>>,
) -> Result<(), Self::DbError>
fn atomic_update( &self, key: &[u8], op: impl FnMut(Option<&[u8]>) -> Option<Vec<u8>>, ) -> Result<(), Self::DbError>
returns the old value
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.