Trait CacheItem

Source
pub trait CacheItem<M = ()>:
    CacheKey<M>
    + Clone
    + Ord {
    type Value: Clone + Debug + PartialEq + 'static;
    type Error: Debug + Error + 'static;

    // Required method
    fn send<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Value, Self::Error>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn superset(&self) -> Vec<Self> { ... }
}
Expand description

Represents some action that can be cached.

The action has one associated type called [Value]. This is the value of data that this action returns. That data is cached, so that future invocations of this item can reuse the previously computed data.

The cached data here can be anything, but typically is a network request. The resulting value is typically the response type of the network request.

Required Associated Types§

Source

type Value: Clone + Debug + PartialEq + 'static

Source

type Error: Debug + Error + 'static

Required Methods§

Source

fn send<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Value, Self::Error>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn superset(&self) -> Vec<Self>

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.

Implementors§