pub trait Provider<Types, T: Request<Types>>: Send + Sync {
// Required method
fn fetch<'life0, 'async_trait>(
&'life0 self,
req: T,
) -> Pin<Box<dyn Future<Output = Option<T::Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A provider which is able to satisfy requests for data of type T
.
This trait use boxed future return types (#[async_trait]
) instead of impl Future
return
types, so that it can be object safe.