Skip to main content

MultiForkByErrorProvider

Struct MultiForkByErrorProvider 

Source
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 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, MarkerNotFoundPredicate>

Source

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

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

See MultiForkByMarkerProvider.

Trait Implementations§

Source§

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

Source§

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

Query the provider for data, returning the result. Read more
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> DryDataProvider<M> for MultiForkByErrorProvider<P, F>

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, P, F> DynamicDataProvider<M> for MultiForkByErrorProvider<P, F>

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, P, F> DynamicDryDataProvider<M> for MultiForkByErrorProvider<P, F>

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<M, P, F> IterableDynamicDataProvider<M> for MultiForkByErrorProvider<P, F>

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> UnsafeUnpin for MultiForkByErrorProvider<P, F>
where F: UnsafeUnpin,

§

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<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, 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<P> BufferProvider for P

Source§

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