python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Call stored closure from an async closure in rust
I have a closure that mutates variables designed outside of it. How would I go about calling this closure that modifies the state from inside an async scope?
I have the following code (abstracted, to ...
SnailsSeveral
Votes: 0
Answers: 1
Chaining adapters with custom `futures::Stream` breaks trait bounds
I needed to implement a custom Stream that yields items in a sliding window (ie. [1, 2, 3] => [(1, 2), (2, 3)]). So I implemented and gave it an adapter called .tuple_windows(). Allowing the follow...
Midnight Exigent
Votes: 0
Answers: 2
Is there a tuple_windows() adapter for async streams?
I have a code the looks like this
use itertools::Itertools;
let (tx, rx) = std::sync::mpsc::channel();
tokio::spawn(async move {
for (v1, v2) in rx.into_iter().tuple_windows() {
// do so...
Midnight Exigent
Votes: 0
Answers: 2