Cache

Trait Cache 

Source
pub trait Cache: Send + Sync {
    // Required methods
    fn new<'async_trait>(    ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn get<'life0, 'async_trait>(
        &'life0 self,
        key: Example,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Prediction>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn insert<'life0, 'async_trait>(
        &'life0 mut self,
        key: Example,
        rx: Receiver<CallResult>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_history<'life0, 'async_trait>(
        &'life0 self,
        n: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CallResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn new<'async_trait>() -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where Self: 'async_trait,

Source

fn get<'life0, 'async_trait>( &'life0 self, key: Example, ) -> Pin<Box<dyn Future<Output = Result<Option<Prediction>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn insert<'life0, 'async_trait>( &'life0 mut self, key: Example, rx: Receiver<CallResult>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_history<'life0, 'async_trait>( &'life0 self, n: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<CallResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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§