Skip to content

Support ? operator in async stream (add async_try_stream) #2

Closed
@taiki-e

Description

@taiki-e

Unlike futures-await, we cannot use ? operator in async_stream. It would be useful if we had more sugar for this.

#[async_try_stream(ok = String, error = io::Error)]
fn fetch_all(client: hyper::Client, urls: Vec<&'static str>) {
    for url in urls {
         yield fetch(client, url).await?;
    }
}

Related: rust-lang/futures-rs#1548 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: A new feature or an improvement for an existing one

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions