futures-rs
futures-rs copied to clipboard
Zero-cost asynchronous programming in Rust
per https://www.reddit.com/r/rust/comments/v6rx10/comment/ibhbcsv/?utm_source=reddit&utm_medium=web2x&context=3
Added a chunked version of try join all. Drives at most n Futures at a time, and then will return once all are completed, or returns early if any error...
We already have `buffered` and `buffer_unordered`. Both of them keep an internal buffer of futures and run each future to completion. My proposal is to add `buffered_latest` and `buffer_latest_unordered` methods...
Here describes an scenario that hangs `stream.forward(sink)` in the polling function of `Forward` ([code](https://github.com/rust-lang/futures-rs/blob/c0e936802828c37f8f961f91ed2c70c513878042/futures-util/src/stream/stream/forward.rs#L51-L73)). The code below is simplified version of the polling function. It goes back and forth between...
`select_early_exit` creates a stream that produces elements while either substream contains elements, and terminates when either substream runs out of elements. ## Previous work https://github.com/rust-lang/futures-rs/pull/1881 https://github.com/rust-lang/futures-rs/pull/1422 ## Benchmarks: | Old...
Fixes #2492
I found some strange behaviour and have minimised it to this: ``` #[derive(Debug,Eq,PartialEq)] struct TestError(char); #[async_test] async fn unfold_crash() { let mut unfold = Box::pin(futures::sink::unfold((), |(), c| async move {...
[As documented](https://docs.rs/futures/0.3.21/futures/future/fn.select_all.html#panics), select_all asserts that the iterator is non-empty. When [this assertion](https://docs.rs/futures-util/0.3.21/src/futures_util/future/select_all.rs.html#40) is removed, the empty SelectAll is always pending. This behavior is more convenient in some cases, like when...
Just similar to [Itertools::group_by](https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.group_by) and can group items of the stream to vectors. ### Example ```rust let data_grouped = stream::iter(vec![1, 3, -2, -2, 1, 0, 1, 2]) .group_by(|elt| *elt >=...
There is currently no way to create a `SendError` which means you have to resort to workarounds as per https://github.com/alexcrichton/futures-rs/issues/401. I've been trying to use this to [stream out a...