pub trait StorageExt: Storage {
// Provided methods
fn set_option_int<'a>(
&'a mut self,
key: &'a str,
value: Option<i64>,
) -> BoxFuture<'_, Result<(), Self::Error>> { ... }
fn get_time<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<SystemTime>> { ... }
fn set_time<'a>(
&'a mut self,
key: &'a str,
value: impl Into<SystemTime>,
) -> BoxFuture<'_, Result<(), Self::Error>> { ... }
fn remove_or_log<'a>(&'a mut self, key: &'a str) -> BoxFuture<'_, ()> { ... }
fn commit_or_log(&mut self) -> BoxFuture<'_, ()> { ... }
}
Expand description
Extension trait that adds some features to Storage that can be implemented using the base
Storage
implementation.
Provided Methods§
Sourcefn set_option_int<'a>(
&'a mut self,
key: &'a str,
value: Option<i64>,
) -> BoxFuture<'_, Result<(), Self::Error>>
fn set_option_int<'a>( &'a mut self, key: &'a str, value: Option<i64>, ) -> BoxFuture<'_, Result<(), Self::Error>>
Set an Option
Sourcefn get_time<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<SystemTime>>
fn get_time<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<SystemTime>>
Get a SystemTime from the backing store. Returns None if there is no value for the given key, or if the value for the key has a different type.
Sourcefn set_time<'a>(
&'a mut self,
key: &'a str,
value: impl Into<SystemTime>,
) -> BoxFuture<'_, Result<(), Self::Error>>
fn set_time<'a>( &'a mut self, key: &'a str, value: impl Into<SystemTime>, ) -> BoxFuture<'_, Result<(), Self::Error>>
Set a SystemTime to be stored in the backing store. The implementation should cache the value until the |commit()| fn is called, and then persist all cached values at that time. Note that submicrosecond will be dropped.
Sourcefn remove_or_log<'a>(&'a mut self, key: &'a str) -> BoxFuture<'_, ()>
fn remove_or_log<'a>(&'a mut self, key: &'a str) -> BoxFuture<'_, ()>
Remove the value for |key| from the backing store, log an error message on error.
Sourcefn commit_or_log(&mut self) -> BoxFuture<'_, ()>
fn commit_or_log(&mut self) -> BoxFuture<'_, ()>
Persist all cached values to storage, log an error message on error.
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.