Crate tonic_middleware
source ·Structs§
InterceptorForwraps a service with aRequestInterceptor, enabling request-level interception before the request reaches the service logic.MiddlewareForis a service wrapper that pairs a middleware with its target service.MiddlewareLayerprovides a way to wrap services with a specific middleware using the towerLayertraitRequestInterceptorLayerprovides a way to wrap services with a specific interceptor using the towerLayertrait
Traits§
- The
Middlewaretrait defines a generic interface for middleware components in a grpc service chain. Implementors of this trait can modify, observe, or otherwise interact with requests and responses in the service pipeline - The
RequestInterceptortrait is designed to enable the interception and processing of incoming requests within your service pipeline. This trait is particularly useful for performing operations such as authentication, enriching requests with additional metadata, or rejecting requests based on certain criteria before they reach the service logic. If your requirements extend beyond request interception, and you need to interact with both the request and response or to perform actions after the service call has been made, you should consider implementingMiddleware.