multiqueue icon indicating copy to clipboard operation
multiqueue copied to clipboard

Make `SendError` visible / coercable

Open CallumJHays opened this issue 7 years ago • 0 comments

I'm attempting to use BroadcastFutReceiver as a stream combinator to get a Cloneable stream that I can share across threads. I have tried something similar to the following:

fn cloneable<I, E, S>(stream: S) -> BroadcastFutReceiver<I>
where
    I: Clone,
    S: Stream<Item = I, Error = E>,
{
    let (send, recv) = broadcast_fut_queue(1);
    send.send_all(stream); // cannot coerce type E to type SendError<E>
    recv
}

The issue I'm having is I'm not sure how to coerce my generic stream error type implementing T: std::error::Error into a multiqueue::SendError<T> as SendError is not public.

CallumJHays avatar Oct 24 '17 04:10 CallumJHays