diff --git a/tarpc/examples/service_registry.rs b/tarpc/examples/service_registry.rs index b880ead..b1f8460 100644 --- a/tarpc/examples/service_registry.rs +++ b/tarpc/examples/service_registry.rs @@ -73,14 +73,14 @@ mod registry { name: String, serve: S, deserialize: De, - serialize: Ser) - -> Registry> - where - Req: Send, - S: FnOnce(context::Context, Req) -> RespFut + Send + 'static + Clone, - RespFut: Future> + Send + 'static, - De: FnOnce(Bytes) -> io::Result + Send + 'static + Clone, - Ser: FnOnce(Resp) -> io::Result + Send + 'static + Clone, + serialize: Ser, + ) -> Registry> + where + Req: Send, + S: FnOnce(context::Context, Req) -> RespFut + Send + 'static + Clone, + RespFut: Future> + Send + 'static, + De: FnOnce(Bytes) -> io::Result + Send + 'static + Clone, + Ser: FnOnce(Resp) -> io::Result + Send + 'static + Clone, { let registrations = Registration { name: name, @@ -188,7 +188,9 @@ mod registry { fn serve(&self, cx: context::Context, request: &ServiceRequest) -> Option { if self.name == request.service_name { - Some(Either::Left(self.serve.clone().serve(cx, request.request.clone()))) + Some(Either::Left( + self.serve.clone().serve(cx, request.request.clone()), + )) } else { self.rest.serve(cx, request).map(Either::Right) } @@ -206,7 +208,7 @@ mod registry { impl Future for Either where Left: Future, - Right: Future + Right: Future, { type Output = Output; @@ -223,7 +225,7 @@ mod registry { impl Serve for F where F: FnOnce(context::Context, Bytes) -> Resp + Clone + Send + 'static, - Resp: Future> + Send + 'static + Resp: Future> + Send + 'static, { type Response = Resp; @@ -316,14 +318,21 @@ struct BincodeRegistry { impl Default for BincodeRegistry { fn default() -> Self { - BincodeRegistry { registry: registry::Registry::default() } + BincodeRegistry { + registry: registry::Registry::default(), + } } } impl BincodeRegistry { - fn serve(self) -> impl FnOnce(context::Context, registry::ServiceRequest) - -> registry::Either>> + Clone - { + fn serve( + self, + ) -> impl FnOnce( + context::Context, registry::ServiceRequest + ) -> registry::Either< + Services::Future, + Ready>, + > + Clone { self.registry.serve() }