From 18cbbe5b151cafc3c6a2051393e70ea4b89279d1 Mon Sep 17 00:00:00 2001 From: Tim Kuehn Date: Mon, 26 Dec 2016 15:30:36 -0500 Subject: [PATCH] impl Clone (again) for the clients --- src/client.rs | 12 ++++++++++++ src/macros.rs | 5 ++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/client.rs b/src/client.rs index d175576..16871c6 100644 --- a/src/client.rs +++ b/src/client.rs @@ -33,6 +33,18 @@ pub struct Client inner: BindClient, } +impl Clone for Client + where Req: Serialize + 'static, + Resp: Deserialize + 'static, + E: Deserialize + 'static, +{ + fn clone(&self) -> Self { + Client { + inner: self.inner.clone(), + } + } +} + impl Service for Client where Req: Serialize + Sync + Send + 'static, Resp: Deserialize + Sync + Send + 'static, diff --git a/src/macros.rs b/src/macros.rs index 45c7f84..c252587 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -424,7 +424,6 @@ macro_rules! service { } } - #[allow(non_camel_case_types)] type __tarpc_service_Future = $crate::futures::Finished<$crate::Response<__tarpc_service_Response, @@ -610,7 +609,7 @@ macro_rules! service { impl SyncServiceExt for S where S: SyncService {} #[allow(unused)] - #[derive(Debug)] + #[derive(Clone, Debug)] /// The client stub that makes RPC calls to the server. Exposes a blocking interface. pub struct SyncClient(FutureClient); @@ -682,7 +681,7 @@ macro_rules! service { } #[allow(unused)] - #[derive(Debug)] + #[derive(Clone, Debug)] /// The client stub that makes RPC calls to the server. Exposes a Future interface. pub struct FutureClient(__tarpc_service_Client);