use super::{BoxBody, BoxError, GrpcWebService}; use tower_layer::Layer; use tower_service::Service; /// Layer implementing the grpc-web protocol. #[derive(Debug, Clone)] pub struct GrpcWebLayer { _priv: (), } impl GrpcWebLayer { /// Create a new grpc-web layer. pub fn new() -> GrpcWebLayer { Self { _priv: () } } } impl Default for GrpcWebLayer { fn default() -> Self { Self::new() } } impl Layer for GrpcWebLayer where S: Service, Response = http::Response>, S: Clone + Send + 'static, S::Future: Send + 'static, S::Error: Into + Send, { type Service = GrpcWebService; fn layer(&self, inner: S) -> Self::Service { GrpcWebService::new(inner) } }