async-rs / async-rs/parallel-stream
Suggestion: Spawn tasks on first poll
Open
- Dominant language
- Rust
- Stars
- 96
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
*"A fundamental difference between Rust's futures and those from other languages is that Rust's futures do not do anything unless polled. "* [[0](https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#hot-async-functions)] I think following this behavior in this crate would make it more consistent with the rest of the ecosystem.
Current behavior: The snippet below keeps printing `"called"` indefinitely even though we did not await it.
```rust
crate::from_stream(async_std::stream::repeat(5usize))
.for_each(|_| async { println!("called") });
```
Contributor guide
Assessment
This issue has not been assessed yet.