futures-rs
futures-rs copied to clipboard
Zero-cost asynchronous programming in Rust
Locking a `Mutex` concurrently from N tasks takes O(N^2) time. [This test](https://github.com/nathdobson/futures-rs/blob/fc025f14d160d4a6d8b7364b4ff6e95ec93d445b/futures/tests/lock_mutex.rs#L72) reproduces the issue. The problem is the use of [`Slab::iter_mut`](https://docs.rs/slab/0.4.2/slab/struct.Slab.html#method.iter_mut) in [`Mutex::unlock`](https://github.com/rust-lang/futures-rs/blob/dddfc35cbde4bd35e7103f4720ebfea1e3c55913/futures-util/src/lock/mutex.rs#L172). `Slab::iter_mut` takes linear time because it...
As of `futures-0.3`, the conversion only goes one direction from `Stream` to `AsyncRead` through `stream::TryStreamExt::into_async_read` but not the other way around. Is this a conscious decision? If so why? If...
closes #2545
This adds utility functions for merge and diff operations on sorted streams in constant space. I had a problem at work where I needed to diff a sorted stream of...
This is really useful when working with GUIs. For example, it can be used to implement type-aheads: https://www.learnrxjs.io/learn-rxjs/recipes/type-ahead See the following for existing implementations in rxjs. https://rxjs.dev/api/operators/switchMap https://www.learnrxjs.io/learn-rxjs/operators/transformation/switchmap#why-use-switchmap. I'm currently...
Implementation of TryAll and TryAny predicates for TrySteamExt. Most of the code is reused from TryFold implementation. The difference between TryFold and TryAll, TryAny is in an early exit. TryAll,...
The `stream.wait_until(fut)` combinator lets the stream to wait until the future resovles. The stream start taking elements if the future resolves to true, otherwise the stream fuses if it resolve...
It should be documeneted in `join`, `join3`, `join4`, ..`join5` that they are concurrently run not run in parallel, and how to run them in parallel. https://docs.rs/tokio/latest/tokio/macro.join.html
Add the `poll_read_buf` method to `AsyncRead` based on the API proposed by https://github.com/rust-lang/rfcs/pull/2930 (tracking issue: rust-lang/rust#78485). ```rust pub trait AsyncRead { fn poll_read_buf(self: Pin, cx: &mut Context) -> Poll; }...