Skip to content

Commit

Permalink
util: enable Either to use underlying AsyncWrite implementation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mox692 authored Dec 9, 2024
1 parent 48e07a6 commit 79a2afa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tokio-util/src/either.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,21 @@ where
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<tokio::io::Result<()>> {
delegate_call!(self.poll_shutdown(cx))
}

fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[std::io::IoSlice<'_>],
) -> Poll<std::result::Result<usize, std::io::Error>> {
delegate_call!(self.poll_write_vectored(cx, bufs))
}

fn is_write_vectored(&self) -> bool {
match self {
Self::Left(l) => l.is_write_vectored(),
Self::Right(r) => r.is_write_vectored(),
}
}
}

impl<L, R> futures_core::stream::Stream for Either<L, R>
Expand Down

0 comments on commit 79a2afa

Please sign in to comment.