feat(server): remove unneeded Send + Sync from Server

Http and Server placed Send + Sync bounds on NewService implementations which
were not actually required given tokio's event loop model. Remove them to reduce
limitations on end users of hyper.
This commit is contained in:
Michael Smith
2017-09-22 12:25:53 -07:00
committed by Sean McArthur
parent 0c7d375ba3
commit 16e834d37c

View File

@@ -96,8 +96,7 @@ impl<B: AsRef<[u8]> + 'static> Http<B> {
/// The returned `Server` contains one method, `run`, which is used to /// The returned `Server` contains one method, `run`, which is used to
/// actually run the server. /// actually run the server.
pub fn bind<S, Bd>(&self, addr: &SocketAddr, new_service: S) -> ::Result<Server<S, Bd>> pub fn bind<S, Bd>(&self, addr: &SocketAddr, new_service: S) -> ::Result<Server<S, Bd>>
where S: NewService<Request = Request, Response = Response<Bd>, Error = ::Error> + where S: NewService<Request = Request, Response = Response<Bd>, Error = ::Error> + 'static,
Send + Sync + 'static,
Bd: Stream<Item=B, Error=::Error>, Bd: Stream<Item=B, Error=::Error>,
{ {
let core = try!(Core::new()); let core = try!(Core::new());
@@ -378,8 +377,7 @@ impl<T, B> Service for HttpService<T>
} }
impl<S, B> Server<S, B> impl<S, B> Server<S, B>
where S: NewService<Request = Request, Response = Response<B>, Error = ::Error> where S: NewService<Request = Request, Response = Response<B>, Error = ::Error> + 'static,
+ Send + Sync + 'static,
B: Stream<Error=::Error> + 'static, B: Stream<Error=::Error> + 'static,
B::Item: AsRef<[u8]>, B::Item: AsRef<[u8]>,
{ {