diff --git a/tarpc/src/macros.rs b/tarpc/src/macros.rs index f068736..e310918 100644 --- a/tarpc/src/macros.rs +++ b/tarpc/src/macros.rs @@ -386,7 +386,8 @@ macro_rules! service_inner { #[allow(unused)] #[doc="The client stub that makes RPC calls to the server."] - pub struct Client($crate::protocol::Client<__Request, __Reply, S>); + pub struct Client($crate::protocol::Client<__Request, __Reply, S>) + where S: $crate::Stream; impl Client<::std::net::TcpStream> { pub fn new(addr: A) -> $crate::Result @@ -396,7 +397,9 @@ macro_rules! service_inner { } } - impl Client { + impl Client + where S: $crate::Stream + { #[allow(unused)] #[doc="Create a new client with default configuration that connects to the given \ address."] @@ -427,7 +430,8 @@ macro_rules! service_inner { #[allow(unused)] #[doc="The client stub that makes asynchronous RPC calls to the server."] - pub struct AsyncClient($crate::protocol::Client<__Request, __Reply, S>); + pub struct AsyncClient($crate::protocol::Client<__Request, __Reply, S>) + where S: $crate::Stream; impl AsyncClient<::std::net::TcpStream> { #[allow(unused)] @@ -440,7 +444,8 @@ macro_rules! service_inner { } } - impl AsyncClient { + impl AsyncClient + where S: $crate::Stream { #[allow(unused)] #[doc="Create a new asynchronous client that connects to the given address."] pub fn with_config(dialer: D, config: $crate::Config) -> $crate::Result @@ -466,7 +471,8 @@ macro_rules! service_inner { } #[allow(unused)] - struct __Server(S); + struct __Server(S) + where S: 'static + Service; impl $crate::protocol::Serve for __Server where S: 'static + Service diff --git a/tarpc/src/protocol/mod.rs b/tarpc/src/protocol/mod.rs index 77bcd67..dda751f 100644 --- a/tarpc/src/protocol/mod.rs +++ b/tarpc/src/protocol/mod.rs @@ -153,7 +153,8 @@ pub trait TcpDialerExt { } /// Connects to a socket address. -pub struct TcpDialer(pub A); +pub struct TcpDialer(pub A) + where A: ToSocketAddrs; impl Dialer for TcpDialer { type Stream = TcpStream; fn dial(&self) -> io::Result { diff --git a/tarpc/src/protocol/server.rs b/tarpc/src/protocol/server.rs index 87b866a..7d237c9 100644 --- a/tarpc/src/protocol/server.rs +++ b/tarpc/src/protocol/server.rs @@ -104,7 +104,7 @@ impl<'a, S, St> ConnectionHandler<'a, S, St> } /// Provides methods for blocking until the server completes, -pub struct ServeHandle +pub struct ServeHandle where D: Dialer { tx: Sender<()>,