pub trait Loader<K: Send + Sync + Hash + Eq + Clone + 'static>: Send + Sync + 'static {
    type Value: Send + Sync + Clone + 'static;
    type Error: Send + Clone + 'static;

    // Required method
    fn load<'life0, 'life1, 'async_trait>(
        &'life0 self,
        keys: &'life1 [K]
    ) -> Pin<Box<dyn Future<Output = Result<HashMap<K, Self::Value>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Available on crate feature dataloader only.
Expand description

Trait for batch loading.

Required Associated Types§

source

type Value: Send + Sync + Clone + 'static

type of value.

source

type Error: Send + Clone + 'static

Type of error.

Required Methods§

source

fn load<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [K] ) -> Pin<Box<dyn Future<Output = Result<HashMap<K, Self::Value>, Self::Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load the data set specified by the keys.

Implementors§