Skip to main content

Provider

Trait Provider 

Source
pub trait Provider: Send + Sync {
    // Required method
    fn ask<'a>(&'a self, request: &'a Request) -> ProviderFuture<'a>;
}
Expand description

A provider must be lazy, cancellation-safe, and free of implicit retries. Consumers should use ask to check response coverage and normalization.

Required Methods§

Source

fn ask<'a>(&'a self, request: &'a Request) -> ProviderFuture<'a>

Answer the state and all its questions in one semantic invocation.

§Errors

The returned future may fail with provider, timeout, unsupported-capability, or input/response-validation errors. Implementations must preserve errors as errors; uncertainty belongs in a successful answer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<P: Provider + ?Sized> Provider for Arc<P>

Source§

fn ask<'a>(&'a self, request: &'a Request) -> ProviderFuture<'a>

Implementors§

Source§

impl Provider for Cascade

Source§

impl Provider for TypeSafe

Available on crate feature typesafe only.
Source§

impl<F> Provider for FunctionProvider<F>
where F: for<'a> Fn(&'a Request) -> ProviderFuture<'a> + Send + Sync,

Source§

impl<P: Provider> Provider for TimeLimited<P>

Available on crate feature tokio only.