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 DataProvider
s. However, it
supports forking between AnyProvider
, BufferProvider
, and DynamicDataProvider
.
Fields§
§providers: Vec<P>
§predicate: F
Implementations§
source§impl<P, F> MultiForkByErrorProvider<P, F>
impl<P, F> MultiForkByErrorProvider<P, F>
sourcepub fn new_with_predicate(providers: Vec<P>, predicate: F) -> Self
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
.
sourcepub fn with_inner_mut(&mut self, f: impl FnOnce(&mut Vec<P>))
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.
sourcepub fn into_inner(self) -> Vec<P>
pub fn into_inner(self) -> Vec<P>
Returns ownership of the inner providers to the caller.
source§impl<P> MultiForkByErrorProvider<P, MissingDataKeyPredicate>
impl<P> MultiForkByErrorProvider<P, MissingDataKeyPredicate>
Trait Implementations§
source§impl<P, F> AnyProvider for MultiForkByErrorProvider<P, F>where
P: AnyProvider,
F: ForkByErrorPredicate,
impl<P, F> AnyProvider for MultiForkByErrorProvider<P, F>where
P: AnyProvider,
F: ForkByErrorPredicate,
source§fn load_any(
&self,
key: DataKey,
req: DataRequest<'_>,
) -> Result<AnyResponse, DataError>
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>where
P: BufferProvider,
F: ForkByErrorPredicate,
impl<P, F> BufferProvider for MultiForkByErrorProvider<P, F>where
P: BufferProvider,
F: ForkByErrorPredicate,
source§fn load_buffer(
&self,
key: DataKey,
req: DataRequest<'_>,
) -> Result<DataResponse<BufferMarker>, DataError>
fn load_buffer( &self, key: DataKey, req: DataRequest<'_>, ) -> Result<DataResponse<BufferMarker>, DataError>
source§impl<M, P, F> DynamicDataProvider<M> for MultiForkByErrorProvider<P, F>
impl<M, P, F> DynamicDataProvider<M> for MultiForkByErrorProvider<P, F>
source§fn load_data(
&self,
key: DataKey,
req: DataRequest<'_>,
) -> Result<DataResponse<M>, DataError>
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>where
F: RefUnwindSafe,
P: RefUnwindSafe,
impl<P, F> Send for MultiForkByErrorProvider<P, F>
impl<P, F> Sync for MultiForkByErrorProvider<P, F>
impl<P, F> Unpin for MultiForkByErrorProvider<P, F>
impl<P, F> UnwindSafe for MultiForkByErrorProvider<P, F>where
F: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
source§impl<P> AsDowncastingAnyProvider for Pwhere
P: AnyProvider + ?Sized,
impl<P> AsDowncastingAnyProvider for Pwhere
P: AnyProvider + ?Sized,
source§fn as_downcasting(&self) -> DowncastingAnyProvider<'_, P>
fn as_downcasting(&self) -> DowncastingAnyProvider<'_, P>
Returns an object implementing
DynamicDataProvider<M>
when called on AnyProvider
source§impl<P> AsDynamicDataProviderAnyMarkerWrap for P
impl<P> AsDynamicDataProviderAnyMarkerWrap for P
source§fn as_any_provider(&self) -> DynamicDataProviderAnyMarkerWrap<'_, P>
fn as_any_provider(&self) -> DynamicDataProviderAnyMarkerWrap<'_, P>
Returns an object implementing
AnyProvider
when called on DynamicDataProvider<AnyMarker>
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
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