futures-rs
futures-rs copied to clipboard
Zero-cost asynchronous programming in Rust
Unlike std::any() and std::all(), the behavior of these functions for empty streams does not seem to be documented. Experimentally, they behave the same (for all()/try_all(), an empty iterator returns true...
This modifies `LocalPool` to accept a generic lifetime parameter, and renames it to `BoundLocalPool` parameter, with `LocalPool` now being an alias for `BoundLocalPool
The size hint for chunks is computed as follows: ```Rust fn size_hint(&self) -> (usize, Option) { let chunk_len = if self.items.is_empty() { 0 } else { 1 }; let (lower,...
This pull request adds the possibility to create wrapped futures that additionally invoke a function when they get polled. The function has mutable access to the Context and the returning...
```rust trait FutureExt { fn also_poll(self, also: Also) -> AlsoPoll // Output = Self::Output where Self: Sized, Also: Future, { // AlsoPoll pseudocode: let mut also = also.fuse(); poll_fn(|cx| {...
The following minimal example has unbounded memory usage: ``` use futures::SinkExt; #[tokio::main] async fn main() { let (tx, rx) = futures::channel::mpsc::channel(16); for i in 0.. { tx.clone().feed(vec![0; 100000]).await.unwrap(); println!("{i}"); }...
In the documentation of `FuturesUnordered` it's written > "When new futures are added, [poll_next](https://docs.rs/futures/0.3.30/futures/stream/trait.Stream.html#tymethod.poll_next) must be called in order to begin receiving wake-ups for new futures." Does it mean that...
There're some use case that we want hold the reference to FuturesUnordered on both read end and write end, however it's seems impossible to do so for now. Or maybe...
This reverts commit 42c2ab0e731892e9ff6c6e7fc28ab11d6eaee804. Potentially fixed by https://github.com/rust-lang/rust/pull/121622.
https://github.com/rust-lang/futures-rs/blob/aafe554b02cbac19d396512b36bce8b688a18115/futures-channel/src/mpsc/mod.rs#L283 As mentioned in the comments, `num_senders` is used only for counting purposes, not for synchronizing access to other shared variables. While SeqCst guarantees the correctness of the program, it...