pub fn try_or<S, E, T>(
handlers: T,
) -> impl Handler<S, E, Output = <T::Combinator as Handler<S, E>>::Output>where
T: TryOrChain<S, E>,
Expand description
Executes the handlers in a tuple or Vec
in order until a handler matches the event and does
not return an error. If any handler matches and returns a non-error, then the output of
that handler is returned, otherwise Handled::Unmatched
.
This is subtly different from chaining calls to Handler::try_or
: the chain is
terminated by [Handler:try_or_unmatched
] (or an equivalent adapter), which tries the output
of the last handler in the combinator chain and returns Unmatched
if the output is an error.
The output type must implement Try
and be the same for all handlers.