mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-02-23 15:49:54 +01:00
Remove unnecessary Sync bound on clients (#147)
This commit is contained in:
@@ -120,9 +120,9 @@ impl<Req, Resp, E> Clone for Client<Req, Resp, E>
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<Req, Resp, E> Service for Client<Req, Resp, E>
|
impl<Req, Resp, E> Service for Client<Req, Resp, E>
|
||||||
where Req: Serialize + Sync + Send + 'static,
|
where Req: Serialize + Send + 'static,
|
||||||
Resp: Deserialize + Sync + Send + 'static,
|
Resp: Deserialize + Send + 'static,
|
||||||
E: Deserialize + Sync + Send + 'static
|
E: Deserialize + Send + 'static
|
||||||
{
|
{
|
||||||
type Request = Req;
|
type Request = Req;
|
||||||
type Response = Resp;
|
type Response = Resp;
|
||||||
@@ -147,9 +147,9 @@ impl<Req, Resp, E> Client<Req, Resp, E>
|
|||||||
E: Deserialize + 'static
|
E: Deserialize + 'static
|
||||||
{
|
{
|
||||||
fn bind(handle: &reactor::Handle, tcp: StreamType, max_payload_size: u64) -> Self
|
fn bind(handle: &reactor::Handle, tcp: StreamType, max_payload_size: u64) -> Self
|
||||||
where Req: Serialize + Sync + Send + 'static,
|
where Req: Serialize + Send + 'static,
|
||||||
Resp: Deserialize + Sync + Send + 'static,
|
Resp: Deserialize + Send + 'static,
|
||||||
E: Deserialize + Sync + Send + 'static
|
E: Deserialize + Send + 'static
|
||||||
{
|
{
|
||||||
let inner = Proto::new(max_payload_size).bind_client(&handle, tcp);
|
let inner = Proto::new(max_payload_size).bind_client(&handle, tcp);
|
||||||
Client { inner }
|
Client { inner }
|
||||||
@@ -187,9 +187,9 @@ pub type ConnectFuture<Req, Resp, E> =
|
|||||||
fn(futures::Canceled) -> io::Error>>;
|
fn(futures::Canceled) -> io::Error>>;
|
||||||
|
|
||||||
impl<Req, Resp, E> ClientExt for Client<Req, Resp, E>
|
impl<Req, Resp, E> ClientExt for Client<Req, Resp, E>
|
||||||
where Req: Serialize + Sync + Send + 'static,
|
where Req: Serialize + Send + 'static,
|
||||||
Resp: Deserialize + Sync + Send + 'static,
|
Resp: Deserialize + Send + 'static,
|
||||||
E: Deserialize + Sync + Send + 'static
|
E: Deserialize + Send + 'static
|
||||||
{
|
{
|
||||||
type ConnectFut = ConnectFuture<Req, Resp, E>;
|
type ConnectFut = ConnectFuture<Req, Resp, E>;
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ impl<Req, Resp, E> fmt::Debug for Client<Req, Resp, E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<Req, Resp, E> Client<Req, Resp, E>
|
impl<Req, Resp, E> Client<Req, Resp, E>
|
||||||
where Req: Serialize + Sync + Send + 'static,
|
where Req: Serialize + Send + 'static,
|
||||||
Resp: Deserialize + Sync + Send + 'static,
|
Resp: Deserialize + Send + 'static,
|
||||||
E: Deserialize + Sync + Send + 'static
|
E: Deserialize + Send + 'static
|
||||||
{
|
{
|
||||||
/// Drives an RPC call for the given request.
|
/// Drives an RPC call for the given request.
|
||||||
pub fn call(&self, request: Req) -> Result<Resp, ::Error<E>> {
|
pub fn call(&self, request: Req) -> Result<Resp, ::Error<E>> {
|
||||||
@@ -128,9 +128,9 @@ pub trait ClientExt: Sized {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<Req, Resp, E> ClientExt for Client<Req, Resp, E>
|
impl<Req, Resp, E> ClientExt for Client<Req, Resp, E>
|
||||||
where Req: Serialize + Sync + Send + 'static,
|
where Req: Serialize + Send + 'static,
|
||||||
Resp: Deserialize + Sync + Send + 'static,
|
Resp: Deserialize + Send + 'static,
|
||||||
E: Deserialize + Sync + Send + 'static
|
E: Deserialize + Send + 'static
|
||||||
{
|
{
|
||||||
fn connect<A>(addr: A, options: Options) -> io::Result<Self>
|
fn connect<A>(addr: A, options: Options) -> io::Result<Self>
|
||||||
where A: ToSocketAddrs
|
where A: ToSocketAddrs
|
||||||
@@ -160,9 +160,9 @@ struct RequestHandler<Req, Resp, E, S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<Req, Resp, E> RequestHandler<Req, Resp, E, FutureClient<Req, Resp, E>>
|
impl<Req, Resp, E> RequestHandler<Req, Resp, E, FutureClient<Req, Resp, E>>
|
||||||
where Req: Serialize + Sync + Send + 'static,
|
where Req: Serialize + Send + 'static,
|
||||||
Resp: Deserialize + Sync + Send + 'static,
|
Resp: Deserialize + Send + 'static,
|
||||||
E: Deserialize + Sync + Send + 'static
|
E: Deserialize + Send + 'static
|
||||||
{
|
{
|
||||||
/// Creates a new `RequestHandler` by connecting a `FutureClient` to the given address
|
/// Creates a new `RequestHandler` by connecting a `FutureClient` to the given address
|
||||||
/// using the given options.
|
/// using the given options.
|
||||||
|
|||||||
Reference in New Issue
Block a user