pub trait ForkByErrorPredicate {
const UNIT_ERROR: DataErrorKind = DataErrorKind::MissingDataKey;
// Required method
fn test(
&self,
key: DataKey,
req: Option<DataRequest<'_>>,
err: DataError,
) -> bool;
}
Expand description
The predicate trait used by ForkByErrorProvider
.
Provided Associated Constants§
sourceconst UNIT_ERROR: DataErrorKind = DataErrorKind::MissingDataKey
const UNIT_ERROR: DataErrorKind = DataErrorKind::MissingDataKey
The error to return if there are zero providers.
Required Methods§
sourcefn test(
&self,
key: DataKey,
req: Option<DataRequest<'_>>,
err: DataError,
) -> bool
fn test( &self, key: DataKey, req: Option<DataRequest<'_>>, err: DataError, ) -> bool
This function is called when a data request fails and there are additional providers that could possibly fulfill the request.
Arguments:
&self
= Reference to the struct implementing the trait (for data capture)key
= TheDataKey
associated with the requestreq
= TheDataRequest
. This may beNone
if there is no request, such as insideIterableDynamicDataProvider
.err
= The error that occurred.
Return value:
true
to discard the error and attempt the request with the next provider.false
to return the error and not perform any additional requests.
Object Safety§
This trait is not object safe.