feat(tonic): add Interceptor trait (#713)

* Expose `Interceptor` trait.

* Revert changes to public API surface.

* Rename types, add deprecated alias for old names.
This commit is contained in:
Yotam Ofek
2021-07-27 11:11:51 -04:00
committed by GitHub
parent 0e33a0241e
commit 8c8f4d1251
9 changed files with 75 additions and 26 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ pub fn generate<T: Service>(
pub fn with_interceptor<F>(inner: T, interceptor: F) -> #service_ident<InterceptedService<T, F>>
where
F: FnMut(tonic::Request<()>) -> Result<tonic::Request<()>, tonic::Status>,
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody>
+1 -1
View File
@@ -104,7 +104,7 @@ pub fn generate<T: Service>(
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: FnMut(tonic::Request<()>) -> Result<tonic::Request<()>, tonic::Status>,
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}