diff --git a/src/macros.rs b/src/macros.rs index 4ef759f..94dcec0 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -21,7 +21,7 @@ macro_rules! future_enum { } impl<__T, __E, $($tp),*> $crate::futures::Future for $name<$($tp),*> - where __T: Send + 'static, + where __T: ::std::marker::Send + 'static, $($inner: $crate::futures::Future),* { type Item = __T; @@ -48,7 +48,7 @@ macro_rules! future_enum { } impl<__T, __E, $($tp),*> $crate::futures::Future for $name<$($tp),*> - where __T: Send + 'static, + where __T: ::std::marker::Send + 'static, $($inner: $crate::futures::Future),* { type Item = __T; @@ -370,7 +370,7 @@ macro_rules! service { snake_to_camel! { /// The type of future returned by the fn of the same name. - type $fn_name: $crate::futures::Future + Send; + type $fn_name: $crate::futures::Future; } $(#[$attr])* @@ -591,7 +591,7 @@ macro_rules! service { $(#[$attr])* #[inline] pub fn $fn_name(&self, $($arg: &$in_),*) - -> impl $crate::futures::Future> + Send + 'static + -> impl $crate::futures::Future> + 'static { $client_req $client_serialize_impl @@ -698,8 +698,7 @@ mod functional_test { fn other_service() { let _ = env_logger::init(); let handle = Server.listen("localhost:0").unwrap(); - let client = - super::other_service::SyncClient::connect(handle.local_addr()).unwrap(); + let client = super::other_service::SyncClient::connect(handle.local_addr()).unwrap(); match client.foo().err().unwrap() { ::Error::ServerDeserialize(_) => {} // good bad => panic!("Expected Error::ServerDeserialize but got {}", bad), diff --git a/src/util.rs b/src/util.rs index 1066b5c..b0710b1 100644 --- a/src/util.rs +++ b/src/util.rs @@ -3,29 +3,10 @@ // Licensed under the MIT License, . // This file may not be copied, modified, or distributed except according to those terms. -use futures; use std::fmt; use std::error::Error; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -/// A trait for easy spawning of futures. -/// -/// `Future`s don't actually perform their computations until spawned via an `Executor`. Typically, -/// an executor will be associated with an event loop. The `fn` provided by `Spawn` handles -/// spawning the future on the static event loop on which tarpc clients and servers run by default. -pub trait Spawn { - /// Spawns a future on the default event loop. - fn spawn(self); -} - -impl Spawn for F - where F: futures::Future + Send + 'static -{ - fn spawn(self) { - ::protocol::LOOP_HANDLE.spawn(move |_| self.then(|_| Ok::<(), ()>(()))) - } -} - /// A bottom type that impls `Error`, `Serialize`, and `Deserialize`. It is impossible to /// instantiate this type. #[derive(Debug)]