Function cubist_proxy::transformer::errors_to_stream
source · pub fn errors_to_stream<S, R, Ei, Eo>(
pair: impl Pair<S, R, Ei> + 'static
) -> impl Pair<S, R, Eo>where
R: Send + 'static,
S: Send + 'static,
Ei: Into<Eo> + Send + 'static,
Eo: Send + 'static,
Expand description
Convert the error type of a Pair, returning a new Pair.
The results of this combinator are:
(1) Errors into the original Pair’s sink are intercepted and returned in the new Pair’s stream.
// ||
// orig_stream --> --(map_err o into)--+---> new_stream
// || ^
// (Error = Ei) || (err) (Error = Eo)
// || |
// orig_sink <-- <-----------(ok)----+---- new_sink
// ||
(2) Errors from the original Pair’s stream are converted (via Into) to the new pair’s error type.
Because of (1), the Error type of the new Sink is trivially changed.
The conv
function handles converting errors from the original Stream.