From 60d92c296a445b352679919c03c5ed2a2a297e16 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Wed, 8 Apr 2015 16:26:12 -0700 Subject: [PATCH] feat(client): remove Clone requirement for NetworkStream in Client --- src/net.rs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/net.rs b/src/net.rs index 1fbc9b98a4..eb4ceca103 100644 --- a/src/net.rs +++ b/src/net.rs @@ -53,25 +53,12 @@ impl<'a, N: NetworkListener + 'a> Iterator for NetworkConnections<'a, N> { } } - /// An abstraction over streams that a Server can utilize. -pub trait NetworkStream: Read + Write + Any + StreamClone + Send + Typeable { +pub trait NetworkStream: Read + Write + Any + Send + Typeable { /// Get the remote address of the underlying connection. fn peer_addr(&mut self) -> io::Result; } -#[doc(hidden)] -pub trait StreamClone { - fn clone_box(&self) -> Box; -} - -impl StreamClone for T { - #[inline] - fn clone_box(&self) -> Box { - Box::new(self.clone()) - } -} - /// A connector creates a NetworkStream. pub trait NetworkConnector { /// Type of Stream to create @@ -92,11 +79,6 @@ impl fmt::Debug for Box { } } -impl Clone for Box { - #[inline] - fn clone(&self) -> Box { self.clone_box() } -} - impl NetworkStream + Send { unsafe fn downcast_ref_unchecked(&self) -> &T { mem::transmute(traitobject::data(self))