Futures-rs: impl Stream for future::Either

Created on 17 Oct 2017  路  5Comments  路  Source: rust-lang/futures-rs

For code that returns one of multiple Streams it'd be nice to have future::Either also impl Stream.

fn foo() -> impl Stream {
    let v = match some_result {
        Ok(v) => v,
        Err(err) => return Either::A(stream::once(Err(err))),
    };

    return Either::B(some_stream(v));
}
C-feature-request

Most helpful comment

Hi. Can this be backported to 0.1 to as well? benefits tokio users

All 5 comments

Sounds like a good idea to me!

Hi. Can this be backported to 0.1 to as well? benefits tokio users

@tekjar I've cherry picked it and made #1682

Thanks @Kixunil

Was this page helpful?
0 / 5 - 0 ratings