diff --git a/tonic-build/src/server.rs b/tonic-build/src/server.rs index 105494321..b9e687b61 100644 --- a/tonic-build/src/server.rs +++ b/tonic-build/src/server.rs @@ -49,7 +49,12 @@ pub fn generate<'a, T: Service<'a>>(service: &'a T, context: &T::Context) -> Tok } } - impl Service> for #server_service { + impl Service> for #server_service + where + T: #server_trait, + B: HttpBody + Send + Sync + 'static, + B::Error: Into + Send + 'static, + { type Response = http::Response; type Error = Never; type Future = BoxFuture; @@ -58,7 +63,7 @@ pub fn generate<'a, T: Service<'a>>(service: &'a T, context: &T::Context) -> Tok Poll::Ready(Ok(())) } - fn call(&mut self, req: http::Request) -> Self::Future { + fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { diff --git a/tonic/src/codegen.rs b/tonic/src/codegen.rs index e5eea9b91..4f0509ad0 100644 --- a/tonic/src/codegen.rs +++ b/tonic/src/codegen.rs @@ -13,9 +13,6 @@ pub use tower_service::Service; pub type StdError = Box; pub use crate::body::Body; -#[cfg(feature = "transport")] -pub use hyper::Body as HyperBody; - pub type BoxFuture = self::Pin> + Send + 'static>>; pub type BoxStream = self::Pin> + Send + 'static>>;