A gRPC interceptor.
gRPC interceptors are similar to middleware but have less flexibility. An interceptor allows
you to do two main things, one is to add/remove/check items in the
MetadataMap of each
request. Two, cancel a request with a
Any function that satisfies the bound
FnMut(Request<()>) -> Result<Request<()>, Status> can be
used as an
An interceptor can be used on both the server and client side through the
See the interceptor example for more details.
Additionally, interceptors is not the recommended way to add logging to your service. For that
a tower middleware is more appropriate since it can also act on the response. For example
middleware supports gRPC out of the box.
Intercept a request before it is sent, optionally cancelling it.