pub struct MultiForkByErrorProvider<P, F> {
    providers: Vec<P>,
    predicate: F,
}
Expand description

A provider that returns data from the first child provider passing a predicate function.

This is an abstract forking provider that must be provided with a type implementing the ForkByErrorPredicate trait.

MultiForkByErrorProvider does not support forking between DataProviders. However, it supports forking between AnyProvider, BufferProvider, and DynamicDataProvider.

Fields§

§providers: Vec<P>§predicate: F

Implementations§

source§

impl<P, F> MultiForkByErrorProvider<P, F>

source

pub fn new_with_predicate(providers: Vec<P>, predicate: F) -> Self

Create a new provider that forks between the vector of children.

The predicate argument should be an instance of a struct implementing ForkByErrorPredicate.

source

pub fn inner(&self) -> &[P]

Returns a slice of the inner providers.

source

pub fn with_inner_mut(&mut self, f: impl FnOnce(&mut Vec<P>))

Exposes a mutable vector of providers to a closure so it can be mutated.

source

pub fn into_inner(self) -> Vec<P>

Returns ownership of the inner providers to the caller.

source

pub fn push(&mut self, provider: P)

Adds an additional child provider.

source§

impl<P> MultiForkByErrorProvider<P, MissingDataKeyPredicate>

source

pub fn new(providers: Vec<P>) -> Self

Create a provider that returns data from the first child provider supporting the key.

See MultiForkByKeyProvider.

Trait Implementations§

source§

impl<P, F> AnyProvider for MultiForkByErrorProvider<P, F>

source§

fn load_any( &self, key: DataKey, req: DataRequest<'_>, ) -> Result<AnyResponse, DataError>

Loads an AnyPayload according to the key and request.
source§

impl<P, F> BufferProvider for MultiForkByErrorProvider<P, F>

source§

fn load_buffer( &self, key: DataKey, req: DataRequest<'_>, ) -> Result<DataResponse<BufferMarker>, DataError>

Loads a DataPayload<BufferMarker> according to the key and request.
source§

impl<P: Debug, F: Debug> Debug for MultiForkByErrorProvider<P, F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<M, P, F> DynamicDataProvider<M> for MultiForkByErrorProvider<P, F>

source§

fn load_data( &self, key: DataKey, req: DataRequest<'_>, ) -> Result<DataResponse<M>, DataError>

Query the provider for data, returning the result. Read more

Auto Trait Implementations§

§

impl<P, F> Freeze for MultiForkByErrorProvider<P, F>
where F: Freeze,

§

impl<P, F> RefUnwindSafe for MultiForkByErrorProvider<P, F>

§

impl<P, F> Send for MultiForkByErrorProvider<P, F>
where F: Send, P: Send,

§

impl<P, F> Sync for MultiForkByErrorProvider<P, F>
where F: Sync, P: Sync,

§

impl<P, F> Unpin for MultiForkByErrorProvider<P, F>
where F: Unpin, P: Unpin,

§

impl<P, F> UnwindSafe for MultiForkByErrorProvider<P, F>
where F: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<P> AsDowncastingAnyProvider for P
where P: AnyProvider + ?Sized,

source§

fn as_downcasting(&self) -> DowncastingAnyProvider<'_, P>

Returns an object implementing DynamicDataProvider<M> when called on AnyProvider
source§

impl<P> AsDynamicDataProviderAnyMarkerWrap for P

source§

fn as_any_provider(&self) -> DynamicDataProviderAnyMarkerWrap<'_, P>

Returns an object implementing AnyProvider when called on DynamicDataProvider<AnyMarker>
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Filterable for T

source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T