Crate tonic_middleware
source ·Structs§
InterceptorFor
wraps a service with aRequestInterceptor
, enabling request-level interception before the request reaches the service logic.MiddlewareFor
is a service wrapper that pairs a middleware with its target service.MiddlewareLayer
provides a way to wrap services with a specific middleware using the towerLayer
traitRequestInterceptorLayer
provides a way to wrap services with a specific interceptor using the towerLayer
trait
Traits§
- The
Middleware
trait 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
RequestInterceptor
trait 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
.