pub trait Updatable: Gettable {
// Required method
fn update<'a>(
&'a mut self,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<(), Self::Error>> + Send + use<'a, Self>;
// Provided methods
fn create<'a>(
&'a mut self,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + use<'a, Self>
where Self: Send { ... }
fn upsert<'a, F>(
&'a mut self,
key: Self::Key,
update: F,
) -> impl Future<Output = Result<(), Self::Error>> + Send + use<'a, Self, F>
where Self: Send,
Self::Value: Default,
F: FnOnce(&mut Self::Value) + Send + 'a { ... }
}Expand description
A mutable key-value store.
Required Methods§
Provided Methods§
Sourcefn create<'a>(
&'a mut self,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + use<'a, Self>where
Self: Send,
fn create<'a>(
&'a mut self,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + use<'a, Self>where
Self: Send,
Creates a new key-value pair in the db. Returns true if the key was created, false if it already existed. The key is not modified if it already existed.
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.