stream: update coop handling for empty and once (#8227)

This commit is contained in:
Nanasi
2026-06-24 12:38:36 +00:00
committed by GitHub
parent 73e8937cc5
commit 95b8895da8
2 changed files with 28 additions and 10 deletions
+9 -1
View File
@@ -40,7 +40,15 @@ pub const fn empty<T>() -> Empty<T> {
impl<T> Stream for Empty<T> {
type Item = T;
fn poll_next(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<T>> {
fn poll_next(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<T>> {
#[cfg(feature = "rt")]
{
use tokio::task::coop;
let coop = std::task::ready!(coop::poll_proceed(_cx));
coop.made_progress();
}
Poll::Ready(None)
}