Function cubist_proxy::transformer::errors_to_sink
source · pub fn errors_to_sink<S, R, Ei, Eo>(
pair: impl Pair<S, R, Ei> + 'static
) -> impl Pair<S, R, Eo>where
R: Send + 'static,
S: Send + 'static,
Ei: Send + 'static,
Eo: Into<Ei> + Send + 'static,
Expand description
Given a Pair, reroute all Err() values from its Stream into its Sink. Returns a new Pair whose Stream outputs all Ok() values and whose Sink connects to the input Pair’s sink.
Convert the Error type of a Pair, returning a new Pair.
The results of this combinator are:
(1) Errors from the original Pair’s Stream are redirected to its Sink,
// ||
// orig_stream --> ----+----(ok)-----------> new_stream
// || |
// (Error = Ei) || (err) (Error = Eo)
// || v
// orig_sink <-- <---+--(map_err o into)-- new_sink
// ||
(2) Errors into the new Pair’s Sink are converted (via Into) to the old pair’s error type.