diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md
index f9c45f5f..f25ee514 100644
--- a/core/CHANGELOG.md
+++ b/core/CHANGELOG.md
@@ -27,6 +27,8 @@
- Remove `EitherFuture2` in favor of `EitherFuture`. See [PR 3340].
+- Remove `EitherOutput` in favor of `future::Either`. See [PR 3341].
+
[PR 3031]: https://github.com/libp2p/rust-libp2p/pull/3031
[PR 3058]: https://github.com/libp2p/rust-libp2p/pull/3058
[PR 3097]: https://github.com/libp2p/rust-libp2p/pull/3097
@@ -36,6 +38,7 @@
[PR 3338]: https://github.com/libp2p/rust-libp2p/pull/3338
[PR 3339]: https://github.com/libp2p/rust-libp2p/pull/3339
[PR 3340]: https://github.com/libp2p/rust-libp2p/pull/3340
+[PR 3341]: https://github.com/libp2p/rust-libp2p/pull/3341
# 0.37.0
diff --git a/core/src/either.rs b/core/src/either.rs
index b25e4e12..0641cd78 100644
--- a/core/src/either.rs
+++ b/core/src/either.rs
@@ -25,167 +25,30 @@ use crate::{
Multiaddr, ProtocolName,
};
use either::Either;
-use futures::{
- io::{IoSlice, IoSliceMut},
- prelude::*,
-};
+use futures::prelude::*;
use pin_project::pin_project;
-use std::{io, pin::Pin, task::Context, task::Poll};
+use std::{pin::Pin, task::Context, task::Poll};
-/// Implements `AsyncRead` and `AsyncWrite` and dispatches all method calls to
-/// either `First` or `Second`.
-#[pin_project(project = EitherOutputProj)]
-#[derive(Debug, Copy, Clone)]
-pub enum EitherOutput {
- First(#[pin] A),
- Second(#[pin] B),
-}
-
-impl AsyncRead for EitherOutput
-where
- A: AsyncRead,
- B: AsyncRead,
-{
- fn poll_read(
- self: Pin<&mut Self>,
- cx: &mut Context<'_>,
- buf: &mut [u8],
- ) -> Poll> {
- match self.project() {
- EitherOutputProj::First(a) => AsyncRead::poll_read(a, cx, buf),
- EitherOutputProj::Second(b) => AsyncRead::poll_read(b, cx, buf),
- }
- }
-
- fn poll_read_vectored(
- self: Pin<&mut Self>,
- cx: &mut Context<'_>,
- bufs: &mut [IoSliceMut<'_>],
- ) -> Poll> {
- match self.project() {
- EitherOutputProj::First(a) => AsyncRead::poll_read_vectored(a, cx, bufs),
- EitherOutputProj::Second(b) => AsyncRead::poll_read_vectored(b, cx, bufs),
- }
- }
-}
-
-impl AsyncWrite for EitherOutput
-where
- A: AsyncWrite,
- B: AsyncWrite,
-{
- fn poll_write(
- self: Pin<&mut Self>,
- cx: &mut Context<'_>,
- buf: &[u8],
- ) -> Poll> {
- match self.project() {
- EitherOutputProj::First(a) => AsyncWrite::poll_write(a, cx, buf),
- EitherOutputProj::Second(b) => AsyncWrite::poll_write(b, cx, buf),
- }
- }
-
- fn poll_write_vectored(
- self: Pin<&mut Self>,
- cx: &mut Context<'_>,
- bufs: &[IoSlice<'_>],
- ) -> Poll> {
- match self.project() {
- EitherOutputProj::First(a) => AsyncWrite::poll_write_vectored(a, cx, bufs),
- EitherOutputProj::Second(b) => AsyncWrite::poll_write_vectored(b, cx, bufs),
- }
- }
-
- fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> {
- match self.project() {
- EitherOutputProj::First(a) => AsyncWrite::poll_flush(a, cx),
- EitherOutputProj::Second(b) => AsyncWrite::poll_flush(b, cx),
- }
- }
-
- fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> {
- match self.project() {
- EitherOutputProj::First(a) => AsyncWrite::poll_close(a, cx),
- EitherOutputProj::Second(b) => AsyncWrite::poll_close(b, cx),
- }
- }
-}
-
-impl Stream for EitherOutput
-where
- A: TryStream,
- B: TryStream,
-{
- type Item = Result>;
-
- fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll