Trait Provider

Source
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.

Required Methods§

Source

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,

Fetch a resource.

Implementations on Foreign Types§

Source§

impl<Types, T, P> Provider<Types, T> for Arc<P>
where T: Request<Types> + 'static, P: Provider<Types, T> + Sync,

Source§

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,

Implementors§

Source§

impl<Types> Provider<Types, LeafRequest<Types>> for AnyProvider<Types>
where Types: NodeType,

Source§

impl<Types> Provider<Types, PayloadRequest> for AnyProvider<Types>
where Types: NodeType,

Source§

impl<Types> Provider<Types, VidCommonRequest> for AnyProvider<Types>
where Types: NodeType,

Source§

impl<Types, T: Send + Request<Types> + 'static> Provider<Types, T> for NoFetching

Source§

impl<Types, Ver: StaticVersionType> Provider<Types, LeafRequest<Types>> for QueryServiceProvider<Ver>
where Types: NodeType,

Source§

impl<Types, Ver: StaticVersionType> Provider<Types, PayloadRequest> for QueryServiceProvider<Ver>
where Types: NodeType,

Source§

impl<Types, Ver: StaticVersionType> Provider<Types, VidCommonRequest> for QueryServiceProvider<Ver>
where Types: NodeType,