async-rs / parallel-stream

Data parallelism library for async-std.
https://docs.rs/parallel-stream
Apache License 2.0
93 stars 16 forks source link

Suggestion: Spawn tasks on first poll #6

Open Thegaram opened 4 years ago

Thegaram commented 4 years ago

"A fundamental difference between Rust's futures and those from other languages is that Rust's futures do not do anything unless polled. " [0] 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.

crate::from_stream(async_std::stream::repeat(5usize))
        .for_each(|_| async { println!("called") });