Skip to main content

race_unary

Function race_unary 

Source
pub async fn race_unary<'a: 'f, 'f, SVC: 'a, SVCS, T, E, F, Fut>(
    services: SVCS,
    f: F,
) -> Result<T, Error<E>>
where F: FnMut(SVC) -> Fut + Copy + 'a, Fut: Future<Output = Option<Result<T, E>>> + 'a, SVCS: IntoIterator<Item = SVC> + 'a, T: Default,
Expand description

Runs a unary operation on all services.

The passed async function describes the operation to run on each service. The control struct can be used to decide whether to ignore a response (continuing with other backends) or return it.

Errors short-circuit.

FUTUREWORK: allow configuring errors to log only (and skip)