Skip to main content

MemoryStorageExt

Trait MemoryStorageExt 

Source
pub trait MemoryStorageExt: MemoryStorage {
    // Provided methods
    fn save_json<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
        &'life0 self,
        category: &'life1 str,
        key: &'life2 str,
        value: &'life3 T,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where T: 'async_trait + Serialize + Send + Sync,
             Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn load_json<'life0, 'life1, 'life2, 'async_trait, T>(
        &'life0 self,
        category: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
       where T: 'async_trait + DeserializeOwned + Send,
             Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Typed helpers for MemoryStorage.

These are extension methods that serialize through Value, so the trait remains dyn-compatible.

Provided Methods§

Source

fn save_json<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, category: &'life1 str, key: &'life2 str, value: &'life3 T, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where T: 'async_trait + Serialize + Send + Sync, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Save a typed serializable value as JSON.

Source

fn load_json<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, category: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Send, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Load a typed deserializable value from JSON.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§