diff --git a/core/src/either.rs b/core/src/either.rs
index 997bbcf6..c993c4d1 100644
--- a/core/src/either.rs
+++ b/core/src/either.rs
@@ -27,12 +27,12 @@ use tokio_io::{AsyncRead, AsyncWrite};
/// Implements `AsyncRead` and `AsyncWrite` and dispatches all method calls to
/// either `First` or `Second`.
#[derive(Debug, Copy, Clone)]
-pub enum EitherSocket {
+pub enum EitherOutput {
First(A),
Second(B),
}
-impl AsyncRead for EitherSocket
+impl AsyncRead for EitherOutput
where
A: AsyncRead,
B: AsyncRead,
@@ -40,13 +40,13 @@ where
#[inline]
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool {
match self {
- &EitherSocket::First(ref a) => a.prepare_uninitialized_buffer(buf),
- &EitherSocket::Second(ref b) => b.prepare_uninitialized_buffer(buf),
+ &EitherOutput::First(ref a) => a.prepare_uninitialized_buffer(buf),
+ &EitherOutput::Second(ref b) => b.prepare_uninitialized_buffer(buf),
}
}
}
-impl Read for EitherSocket
+impl Read for EitherOutput
where
A: Read,
B: Read,
@@ -54,13 +54,13 @@ where
#[inline]
fn read(&mut self, buf: &mut [u8]) -> Result {
match self {
- &mut EitherSocket::First(ref mut a) => a.read(buf),
- &mut EitherSocket::Second(ref mut b) => b.read(buf),
+ &mut EitherOutput::First(ref mut a) => a.read(buf),
+ &mut EitherOutput::Second(ref mut b) => b.read(buf),
}
}
}
-impl AsyncWrite for EitherSocket
+impl AsyncWrite for EitherOutput
where
A: AsyncWrite,
B: AsyncWrite,
@@ -68,13 +68,13 @@ where
#[inline]
fn shutdown(&mut self) -> Poll<(), IoError> {
match self {
- &mut EitherSocket::First(ref mut a) => a.shutdown(),
- &mut EitherSocket::Second(ref mut b) => b.shutdown(),
+ &mut EitherOutput::First(ref mut a) => a.shutdown(),
+ &mut EitherOutput::Second(ref mut b) => b.shutdown(),
}
}
}
-impl Write for EitherSocket
+impl Write for EitherOutput
where
A: Write,
B: Write,
@@ -82,42 +82,42 @@ where
#[inline]
fn write(&mut self, buf: &[u8]) -> Result {
match self {
- &mut EitherSocket::First(ref mut a) => a.write(buf),
- &mut EitherSocket::Second(ref mut b) => b.write(buf),
+ &mut EitherOutput::First(ref mut a) => a.write(buf),
+ &mut EitherOutput::Second(ref mut b) => b.write(buf),
}
}
#[inline]
fn flush(&mut self) -> Result<(), IoError> {
match self {
- &mut EitherSocket::First(ref mut a) => a.flush(),
- &mut EitherSocket::Second(ref mut b) => b.flush(),
+ &mut EitherOutput::First(ref mut a) => a.flush(),
+ &mut EitherOutput::Second(ref mut b) => b.flush(),
}
}
}
-impl StreamMuxer for EitherSocket
+impl StreamMuxer for EitherOutput
where
A: StreamMuxer,
B: StreamMuxer,
{
- type Substream = EitherSocket;
+ type Substream = EitherOutput;
type InboundSubstream = EitherInbound;
type OutboundSubstream = EitherOutbound;
#[inline]
fn inbound(self) -> Self::InboundSubstream {
match self {
- EitherSocket::First(a) => EitherInbound::A(a.inbound()),
- EitherSocket::Second(b) => EitherInbound::B(b.inbound()),
+ EitherOutput::First(a) => EitherInbound::A(a.inbound()),
+ EitherOutput::Second(b) => EitherInbound::B(b.inbound()),
}
}
#[inline]
fn outbound(self) -> Self::OutboundSubstream {
match self {
- EitherSocket::First(a) => EitherOutbound::A(a.outbound()),
- EitherSocket::Second(b) => EitherOutbound::B(b.outbound()),
+ EitherOutput::First(a) => EitherOutbound::A(a.outbound()),
+ EitherOutput::Second(b) => EitherOutbound::B(b.outbound()),
}
}
}
@@ -133,7 +133,7 @@ where
A: StreamMuxer,
B: StreamMuxer,
{
- type Item = Option>;
+ type Item = Option>;
type Error = IoError;
#[inline]
@@ -141,11 +141,11 @@ where
match *self {
EitherInbound::A(ref mut a) => {
let item = try_ready!(a.poll());
- Ok(Async::Ready(item.map(EitherSocket::First)))
+ Ok(Async::Ready(item.map(EitherOutput::First)))
}
EitherInbound::B(ref mut b) => {
let item = try_ready!(b.poll());
- Ok(Async::Ready(item.map(EitherSocket::Second)))
+ Ok(Async::Ready(item.map(EitherOutput::Second)))
}
}
}
@@ -162,7 +162,7 @@ where
A: StreamMuxer,
B: StreamMuxer,
{
- type Item = Option>;
+ type Item = Option>;
type Error = IoError;
#[inline]
@@ -170,11 +170,11 @@ where
match *self {
EitherOutbound::A(ref mut a) => {
let item = try_ready!(a.poll());
- Ok(Async::Ready(item.map(EitherSocket::First)))
+ Ok(Async::Ready(item.map(EitherOutput::First)))
}
EitherOutbound::B(ref mut b) => {
let item = try_ready!(b.poll());
- Ok(Async::Ready(item.map(EitherSocket::Second)))
+ Ok(Async::Ready(item.map(EitherOutput::Second)))
}
}
}
@@ -220,7 +220,7 @@ where
A: Future- ,
B: Future
- ,
{
- type Item = (EitherSocket, Multiaddr);
+ type Item = (EitherOutput, Multiaddr);
type Error = IoError;
#[inline]
@@ -228,11 +228,11 @@ where
match self {
&mut EitherListenUpgrade::First(ref mut a) => {
let (item, addr) = try_ready!(a.poll());
- Ok(Async::Ready((EitherSocket::First(item), addr)))
+ Ok(Async::Ready((EitherOutput::First(item), addr)))
}
&mut EitherListenUpgrade::Second(ref mut b) => {
let (item, addr) = try_ready!(b.poll());
- Ok(Async::Ready((EitherSocket::Second(item), addr)))
+ Ok(Async::Ready((EitherOutput::Second(item), addr)))
}
}
}
diff --git a/core/src/transport/choice.rs b/core/src/transport/choice.rs
index 69a1265a..6b997d47 100644
--- a/core/src/transport/choice.rs
+++ b/core/src/transport/choice.rs
@@ -18,7 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
-use either::{EitherListenStream, EitherListenUpgrade, EitherSocket};
+use either::{EitherListenStream, EitherListenUpgrade, EitherOutput};
use futures::prelude::*;
use multiaddr::Multiaddr;
use std::io::Error as IoError;
@@ -39,7 +39,7 @@ where
A: Transport,
B: Transport,
{
- type Output = EitherSocket;
+ type Output = EitherOutput;
type Listener = EitherListenStream;
type ListenerUpgrade = EitherListenUpgrade;
type Dial =
@@ -93,16 +93,16 @@ where
{
type Incoming = Box>;
type IncomingUpgrade =
- Box, Multiaddr), Error = IoError>>;
+ Box, Multiaddr), Error = IoError>>;
#[inline]
fn next_incoming(self) -> Self::Incoming {
let first = self.0.next_incoming().map(|out| {
- let fut = out.map(move |(v, addr)| (EitherSocket::First(v), addr));
+ let fut = out.map(move |(v, addr)| (EitherOutput::First(v), addr));
Box::new(fut) as Box>
});
let second = self.1.next_incoming().map(|out| {
- let fut = out.map(move |(v, addr)| (EitherSocket::Second(v), addr));
+ let fut = out.map(move |(v, addr)| (EitherOutput::Second(v), addr));
Box::new(fut) as Box>
});
let future = first.select(second).map(|(i, _)| i).map_err(|(e, _)| e);
diff --git a/core/src/upgrade/choice.rs b/core/src/upgrade/choice.rs
index a2a70ce5..b1a163d3 100644
--- a/core/src/upgrade/choice.rs
+++ b/core/src/upgrade/choice.rs
@@ -19,7 +19,7 @@
// DEALINGS IN THE SOFTWARE.
use bytes::Bytes;
-use either::EitherSocket;
+use either::EitherOutput;
use futures::prelude::*;
use multiaddr::Multiaddr;
use std::io::Error as IoError;
@@ -56,7 +56,7 @@ where
}
}
- type Output = EitherSocket;
+ type Output = EitherOutput;
type Future = EitherConnUpgrFuture;
#[inline]
@@ -87,7 +87,7 @@ pub enum EitherUpgradeIdentifier {
/// Implements `Future` and redirects calls to either `First` or `Second`.
///
-/// Additionally, the output will be wrapped inside a `EitherSocket`.
+/// Additionally, the output will be wrapped inside a `EitherOutput`.
///
// TODO: This type is needed because of the lack of `impl Trait` in stable Rust.
// If Rust had impl Trait we could use the Either enum from the futures crate and add some
@@ -103,7 +103,7 @@ where
A: Future,
B: Future,
{
- type Item = EitherSocket;
+ type Item = EitherOutput;
type Error = IoError;
#[inline]
@@ -111,11 +111,11 @@ where
match self {
&mut EitherConnUpgrFuture::First(ref mut a) => {
let item = try_ready!(a.poll());
- Ok(Async::Ready(EitherSocket::First(item)))
+ Ok(Async::Ready(EitherOutput::First(item)))
}
&mut EitherConnUpgrFuture::Second(ref mut b) => {
let item = try_ready!(b.poll());
- Ok(Async::Ready(EitherSocket::Second(item)))
+ Ok(Async::Ready(EitherOutput::Second(item)))
}
}
}