{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreibuox5ozlvps3sy56gh3fm2grhox3uvho46j2w3wij5b6wwp6csim",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mjb53eztnlh2"
  },
  "path": "/t/going-from-asyncwrite-to-asyncread/24130#post_7",
  "publishedAt": "2026-04-11T12:25:00.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "What do you mean, by ‘stop executing’? E.g. returning `Poll::Pending` because of a Mutex? The future at position 1 can still continue, right? Or is the problem, that `some_other_async` might not continue for some time untill there is space?\n\nEdit: Or did you mean, that, if future1 returns io::Error, future2 doesn’t continue? This is not possible with join, since the Error of future_1 can only be propagated, when `some_other_async` finishes too…\n\nDid you think about this? ```\n\n\n    let other = std::pin::pin!(some_other_async());\n    let stream = Stream::new(|w: Writer| async move {\n        tokio::join!(async {\n            let mut w = std::pin::pin!(w);\n            write_all(&mut w, &[42]).await?;\n            write_all(w, &[42]).await\n        }, async {\n            other.await;\n        });\n    });\n    consume(stream).await;\n    /// Here, other could not be unfinished, even if there is still a ref available\n\n\nIf we just make sure, that we always finish the future which is given into `Stream::new`, we should be good… In contrast if it were a Sender::Item=Result<(), io::Error>, the future doens’t have the possibility to send a Std::err and not be done… It can only finish via `Err(io::Error)` to propagate errors…",
  "title": "Going from AsyncWrite to AsyncRead"
}