{"action":"created","issue":{"url":"https://api.github.com/repos/alexcrichton/futures-await/issues/7","repository_url":"https://api.github.com/repos/alexcrichton/futures-await","labels_url":"https://api.github.com/repos/alexcrichton/futures-await/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/alexcrichton/futures-await/issues/7/comments","events_url":"https://api.github.com/repos/alexcrichton/futures-await/issues/7/events","html_url":"https://github.com/alexcrichton/futures-await/issues/7","id":253858911,"number":7,"title":"Returning a Stream","user":{"login":"pentlander","id":4499912,"avatar_url":"https://avatars1.githubusercontent.com/u/4499912?v=4","gravatar_id":"","url":"https://api.github.com/users/pentlander","html_url":"https://github.com/pentlander","followers_url":"https://api.github.com/users/pentlander/followers","following_url":"https://api.github.com/users/pentlander/following{/other_user}","gists_url":"https://api.github.com/users/pentlander/gists{/gist_id}","starred_url":"https://api.github.com/users/pentlander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pentlander/subscriptions","organizations_url":"https://api.github.com/users/pentlander/orgs","repos_url":"https://api.github.com/users/pentlander/repos","events_url":"https://api.github.com/users/pentlander/events{/privacy}","received_events_url":"https://api.github.com/users/pentlander/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-08-30T02:24:30Z","updated_at":"2017-09-01T22:43:43Z","closed_at":null,"author_association":"NONE","body":"It looks like the current async/await only uses yield without a value, however I saw that in the RFC it mentioned the ability to yield a value. It seems like yielding a value could be used to implement a Steam, is this possible in the new nightly? Ideally it would look something like this (ignoring some slight syntax errors):\r\n\r\n```rust\r\n// It would convert the iterator to Stream<Baz>\r\n#[async] \r\nfn foo(stream: Stream<Bar>) -> impl Iterator<Result<Baz>> {\r\n    #[async]\r\n    for bar in stream {\r\n        let baz = bar_to_baz(bar);\r\n        yield baz;\r\n    } \r\n} \r\n```"},"comment":{"url":"https://api.github.com/repos/alexcrichton/futures-await/issues/comments/326698856","html_url":"https://github.com/alexcrichton/futures-await/issues/7#issuecomment-326698856","issue_url":"https://api.github.com/repos/alexcrichton/futures-await/issues/7","id":326698856,"user":{"login":"rushmorem","id":4958190,"avatar_url":"https://avatars1.githubusercontent.com/u/4958190?v=4","gravatar_id":"","url":"https://api.github.com/users/rushmorem","html_url":"https://github.com/rushmorem","followers_url":"https://api.github.com/users/rushmorem/followers","following_url":"https://api.github.com/users/rushmorem/following{/other_user}","gists_url":"https://api.github.com/users/rushmorem/gists{/gist_id}","starred_url":"https://api.github.com/users/rushmorem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rushmorem/subscriptions","organizations_url":"https://api.github.com/users/rushmorem/orgs","repos_url":"https://api.github.com/users/rushmorem/repos","events_url":"https://api.github.com/users/rushmorem/events{/privacy}","received_events_url":"https://api.github.com/users/rushmorem/received_events","type":"User","site_admin":false},"created_at":"2017-09-01T22:43:43Z","updated_at":"2017-09-01T22:43:43Z","author_association":"NONE","body":"@alexcrichton @Nemo157 How about:-\r\n\r\n```rust\r\n#[async_stream]\r\nfn foo() -> Result<Option<T>, E> {\r\n    // ...\r\n        stream_yield!(T);\r\n    // ...\r\n    Ok(None)\r\n}\r\n```\r\n\r\nto generate a impl Stream<Item = T, Error = E> instead? This is consistent with `Poll` and is more intuitive IMHO."}}
{"actor":{"display_login":"rushmorem"}}