Trait DataLoaderFetcher

Source
pub trait DataLoaderFetcher {
    type Key: Clone + Eq + Hash + Send + Sync;
    type Value: Clone + Send + Sync;

    // Required method
    fn load(
        &self,
        keys: HashSet<Self::Key>,
    ) -> impl Future<Output = Option<HashMap<Self::Key, Self::Value>>> + Send;
}
Expand description

A trait for fetching data in batches

Required Associated Types§

Source

type Key: Clone + Eq + Hash + Send + Sync

The incoming key type

Source

type Value: Clone + Send + Sync

The outgoing value type

Required Methods§

Source

fn load( &self, keys: HashSet<Self::Key>, ) -> impl Future<Output = Option<HashMap<Self::Key, Self::Value>>> + Send

Load a batch of keys

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§