Skip to content

Commit 9d83ed6

Browse files
committed
Merge pull request #474 from hyperium/unclone
feat(client): remove Clone requirement for NetworkStream in Client
2 parents e814680 + 60d92c2 commit 9d83ed6

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/net.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,12 @@ impl<'a, N: NetworkListener + 'a> Iterator for NetworkConnections<'a, N> {
5353
}
5454
}
5555

56-
5756
/// An abstraction over streams that a Server can utilize.
58-
pub trait NetworkStream: Read + Write + Any + StreamClone + Send + Typeable {
57+
pub trait NetworkStream: Read + Write + Any + Send + Typeable {
5958
/// Get the remote address of the underlying connection.
6059
fn peer_addr(&mut self) -> io::Result<SocketAddr>;
6160
}
6261

63-
#[doc(hidden)]
64-
pub trait StreamClone {
65-
fn clone_box(&self) -> Box<NetworkStream + Send>;
66-
}
67-
68-
impl<T: NetworkStream + Send + Clone> StreamClone for T {
69-
#[inline]
70-
fn clone_box(&self) -> Box<NetworkStream + Send> {
71-
Box::new(self.clone())
72-
}
73-
}
74-
7562
/// A connector creates a NetworkStream.
7663
pub trait NetworkConnector {
7764
/// Type of Stream to create
@@ -92,11 +79,6 @@ impl fmt::Debug for Box<NetworkStream + Send> {
9279
}
9380
}
9481

95-
impl Clone for Box<NetworkStream + Send> {
96-
#[inline]
97-
fn clone(&self) -> Box<NetworkStream + Send> { self.clone_box() }
98-
}
99-
10082
impl NetworkStream + Send {
10183
unsafe fn downcast_ref_unchecked<T: 'static>(&self) -> &T {
10284
mem::transmute(traitobject::data(self))

0 commit comments

Comments
 (0)