Struct icu_provider_adapters::fork::ForkByErrorProvider
source · pub struct ForkByErrorProvider<P0, P1, F>(P0, P1, F);
Expand description
A provider that returns data from one of two child providers based on a predicate function.
This is an abstract forking provider that must be provided with a type implementing the
ForkByErrorPredicate
trait.
ForkByErrorProvider
does not support forking between DataProvider
s. However, it
supports forking between AnyProvider
, BufferProvider
, and DynamicDataProvider
.
Tuple Fields§
§0: P0
§1: P1
§2: F
Implementations§
source§impl<P0, P1, F> ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> ForkByErrorProvider<P0, P1, F>
sourcepub fn new_with_predicate(p0: P0, p1: P1, predicate: F) -> Self
pub fn new_with_predicate(p0: P0, p1: P1, predicate: F) -> Self
Create a new provider that forks between the two children.
The predicate
argument should be an instance of a struct implementing
ForkByErrorPredicate
.
sourcepub fn inner_mut(&mut self) -> (&mut P0, &mut P1)
pub fn inner_mut(&mut self) -> (&mut P0, &mut P1)
Returns mutable references to the inner providers.
sourcepub fn into_inner(self) -> (P0, P1)
pub fn into_inner(self) -> (P0, P1)
Returns ownership of the inner providers to the caller.
source§impl<P0, P1> ForkByErrorProvider<P0, P1, MissingDataKeyPredicate>
impl<P0, P1> ForkByErrorProvider<P0, P1, MissingDataKeyPredicate>
sourcepub fn new(p0: P0, p1: P1) -> Self
pub fn new(p0: P0, p1: P1) -> Self
A provider that returns data from one of two child providers based on the key.
See ForkByKeyProvider
.
Trait Implementations§
source§impl<P0, P1, F> AnyProvider for ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> AnyProvider for ForkByErrorProvider<P0, P1, F>
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<P0, P1, F> BufferProvider for ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> BufferProvider for ForkByErrorProvider<P0, P1, F>
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, P0, P1, F> DynamicDataProvider<M> for ForkByErrorProvider<P0, P1, F>where
M: DataMarker,
P0: DynamicDataProvider<M>,
P1: DynamicDataProvider<M>,
F: ForkByErrorPredicate,
impl<M, P0, P1, F> DynamicDataProvider<M> for ForkByErrorProvider<P0, P1, F>where
M: DataMarker,
P0: DynamicDataProvider<M>,
P1: DynamicDataProvider<M>,
F: ForkByErrorPredicate,
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
source§impl<P0: PartialEq, P1: PartialEq, F: PartialEq> PartialEq for ForkByErrorProvider<P0, P1, F>
impl<P0: PartialEq, P1: PartialEq, F: PartialEq> PartialEq for ForkByErrorProvider<P0, P1, F>
source§fn eq(&self, other: &ForkByErrorProvider<P0, P1, F>) -> bool
fn eq(&self, other: &ForkByErrorProvider<P0, P1, F>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl<P0: Eq, P1: Eq, F: Eq> Eq for ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> StructuralPartialEq for ForkByErrorProvider<P0, P1, F>
Auto Trait Implementations§
impl<P0, P1, F> Freeze for ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> RefUnwindSafe for ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> Send for ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> Sync for ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> Unpin for ForkByErrorProvider<P0, P1, F>
impl<P0, P1, F> UnwindSafe for ForkByErrorProvider<P0, P1, F>
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