pub trait DataLoader {
type Key;
type Value;
type Error;
// Required methods
fn load(
&self,
key: Self::Key,
) -> impl Future<Output = Result<Option<Self::Value>, Self::Error>>;
fn load_many(
&self,
keys: impl IntoIterator<Item = Self::Key> + Send,
) -> impl Future<Output = Result<HashMap<Self::Key, Self::Value>, Self::Error>>;
}
Required Associated Types§
Required Methods§
fn load( &self, key: Self::Key, ) -> impl Future<Output = Result<Option<Self::Value>, Self::Error>>
fn load_many( &self, keys: impl IntoIterator<Item = Self::Key> + Send, ) -> impl Future<Output = Result<HashMap<Self::Key, Self::Value>, Self::Error>>
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.