Struct icu_provider_adapters::fork::ForkByErrorProvider

source ·
pub struct ForkByErrorProvider<P0, P1, F>(/* private fields */);
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].

Implementations§

source§

impl<P0, P1, F> ForkByErrorProvider<P0, P1, F>

source

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.

source

pub fn inner(&self) -> (&P0, &P1)

Returns references to the inner providers.

source

pub fn inner_mut(&mut self) -> (&mut P0, &mut P1)

Returns mutable references to the inner providers.

source

pub fn into_inner(self) -> (P0, P1)

Returns ownership of the inner providers to the caller.

source§

impl<P0, P1> ForkByErrorProvider<P0, P1, MarkerNotFoundPredicate>

source

pub fn new(p0: P0, p1: P1) -> Self

A provider that returns data from one of two child providers based on the marker.

See ForkByMarkerProvider.

Trait Implementations§

source§

impl<P0, P1, F> AnyProvider for ForkByErrorProvider<P0, P1, F>
where P0: AnyProvider, P1: AnyProvider, F: ForkByErrorPredicate,

source§

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

Loads an [AnyPayload] according to the marker and request.
source§

impl<M, P0, P1, F> DataProvider<M> for ForkByErrorProvider<P0, P1, F>
where M: DataMarker, P0: DataProvider<M>, P1: DataProvider<M>, F: ForkByErrorPredicate,

source§

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

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

impl<P0: Debug, P1: Debug, F: Debug> Debug for ForkByErrorProvider<P0, P1, F>

source§

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

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

impl<M, P0, P1, F> DryDataProvider<M> for ForkByErrorProvider<P0, P1, F>
where M: DataMarker, P0: DryDataProvider<M>, P1: DryDataProvider<M>, F: ForkByErrorPredicate,

source§

fn dry_load( &self, req: DataRequest<'_>, ) -> Result<DataResponseMetadata, DataError>

This method goes through the motions of load, but only returns the metadata. Read more
source§

impl<M, P0, P1, F> DynamicDataProvider<M> for ForkByErrorProvider<P0, P1, F>
where M: DynamicDataMarker, P0: DynamicDataProvider<M>, P1: DynamicDataProvider<M>, F: ForkByErrorPredicate,

source§

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

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

impl<M, P0, P1, F> DynamicDryDataProvider<M> for ForkByErrorProvider<P0, P1, F>
where M: DynamicDataMarker, P0: DynamicDryDataProvider<M>, P1: DynamicDryDataProvider<M>, F: ForkByErrorPredicate,

source§

fn dry_load_data( &self, marker: DataMarkerInfo, req: DataRequest<'_>, ) -> Result<DataResponseMetadata, DataError>

This method goes through the motions of load_data, but only returns the metadata. Read more
source§

impl<P0, P1, F> ExportableProvider for ForkByErrorProvider<P0, P1, F>
where P0: ExportableProvider, P1: ExportableProvider, F: ForkByErrorPredicate + Sync,

source§

fn supported_markers(&self) -> HashSet<DataMarkerInfo>

Returns the set of supported markers
source§

impl<M, P0, P1, F> IterableDynamicDataProvider<M> for ForkByErrorProvider<P0, P1, F>
where M: DynamicDataMarker, P0: IterableDynamicDataProvider<M>, P1: IterableDynamicDataProvider<M>, F: ForkByErrorPredicate,

source§

fn iter_ids_for_marker( &self, marker: DataMarkerInfo, ) -> Result<BTreeSet<DataIdentifierCow<'_>>, DataError>

Given a [DataMarkerInfo], returns a set of [DataIdentifierCow].
source§

impl<P0: PartialEq, P1: PartialEq, F: PartialEq> PartialEq for ForkByErrorProvider<P0, P1, F>

source§

fn eq(&self, other: &ForkByErrorProvider<P0, P1, F>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<P0: Eq, P1: Eq, F: Eq> Eq for ForkByErrorProvider<P0, P1, F>

source§

impl<P0, P1, F> StructuralPartialEq for ForkByErrorProvider<P0, P1, F>

Auto Trait Implementations§

§

impl<P0, P1, F> Freeze for ForkByErrorProvider<P0, P1, F>
where P0: Freeze, P1: Freeze, F: Freeze,

§

impl<P0, P1, F> RefUnwindSafe for ForkByErrorProvider<P0, P1, F>

§

impl<P0, P1, F> Send for ForkByErrorProvider<P0, P1, F>
where P0: Send, P1: Send, F: Send,

§

impl<P0, P1, F> Sync for ForkByErrorProvider<P0, P1, F>
where P0: Sync, P1: Sync, F: Sync,

§

impl<P0, P1, F> Unpin for ForkByErrorProvider<P0, P1, F>
where P0: Unpin, P1: Unpin, F: Unpin,

§

impl<P0, P1, F> UnwindSafe for ForkByErrorProvider<P0, P1, F>
where P0: UnwindSafe, P1: UnwindSafe, F: 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
§

impl<P> AsDeserializingBufferProvider for P
where P: BufferProvider + ?Sized,

§

fn as_deserializing(&self) -> DeserializingBufferProvider<'_, P>

Wrap this [BufferProvider] in a [DeserializingBufferProvider].

This requires enabling the deserialization Cargo feature for the expected format(s):

  • deserialize_json
  • deserialize_postcard_1
  • deserialize_bincode_1
§

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

§

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

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

impl<P> AsDynamicDataProviderAnyMarkerWrap for P
where P: DynamicDataProvider<AnyMarker> + ?Sized,

§

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> 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
§

impl<P> BufferProvider for P
where P: DynamicDataProvider<BufferMarker> + ?Sized,

§

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

§

impl<T> MaybeSendSync for T
where T: Send + Sync,