futures-async-stream icon indicating copy to clipboard operation
futures-async-stream copied to clipboard

Support chained stream

Open ethe opened this issue 1 year ago • 1 comments

Got compiling error on below code:

pub fn chained_stream() -> impl Stream {
    #[stream]
    async {
        yield 1;
    }
    .map(|d| d * 2)
}
error: unexpected token
   --> tests/stream.rs:215:6
    |
215 |     .map(|d| d * 2)
    |      ^^^

I think relying on feature stmt_expr_attributes would makes a little bit hard to support this.

ethe avatar Jan 12 '24 17:01 ethe

relying on feature stmt_expr_attributes

FYI, you can use stream_block macro to work around stmt_expr_attributes.

taiki-e avatar Jan 12 '24 17:01 taiki-e