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§

source

fn set_option_int<'a>( &'a mut self, key: &'a str, value: Option<i64> ) -> BoxFuture<'_, Result<(), Self::Error>>

Set an Option 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. If the Option is None, the implementation should call |remove()| for the key.

source

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.

source

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.

source

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.

source

fn commit_or_log(&mut self) -> BoxFuture<'_, ()>

Persist all cached values to storage, log an error message on error.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> StorageExt for T
where T: Storage,