External Publication
Visit Post

Going from AsyncWrite to AsyncRead

Rust Internals [Unofficial] April 11, 2026
Source

Basically the problem is this scenario:

let stream = Stream::new(|w: Writer| async move {
    tokio::join!(async {
        let mut w = std::pin::pin!(w);
        write_all(&mut w, &[42]).await?;
        write_all(w, &[42]).await
    }, async {
        some_other_async().await;
    });
});

In this code, execution of code inside some_other_async().await may randomly stop executing at any .await point.

Discussion in the ATmosphere

Loading comments...