Function cubist_proxy::transformer::switch_convert_stream
source · pub async fn switch_convert_stream<Ti, To1, To2, E1, E2>(
strm: impl Stream<Item = Ti> + Unpin,
conv: impl Fn(Ti) -> Result<To1, To2>,
send_ok: impl Sink<To1, Error = E1> + Unpin,
send_err: impl Sink<To2, Error = E2> + Unpin
) -> Result<(), FatalErr>where
E1: Into<FatalErr>,
E2: Into<FatalErr>,
Expand description
Route values from an input stream to one of two output sinks according to
a function that converts the value to either the type of the send_ok
stream
or the type of the send_err
stream.