diff --git a/examples/src/interceptor/client.rs b/examples/src/interceptor/client.rs index 6ef183b12..570679f1a 100644 --- a/examples/src/interceptor/client.rs +++ b/examples/src/interceptor/client.rs @@ -43,7 +43,7 @@ fn intercept(req: Request<()>) -> Result, Status> { struct MyInterceptor; impl Interceptor for MyInterceptor { - fn call(&mut self, request: tonic::Request<()>) -> Result, Status> { + fn intercept(&mut self, request: tonic::Request<()>) -> Result, Status> { Ok(request) } } diff --git a/tonic/src/service/interceptor.rs b/tonic/src/service/interceptor.rs index 4e53061a7..1544775de 100644 --- a/tonic/src/service/interceptor.rs +++ b/tonic/src/service/interceptor.rs @@ -40,14 +40,14 @@ use tower_service::Service; /// [tower-example]: https://github.com/hyperium/tonic/tree/master/examples/src/tower pub trait Interceptor { /// Intercept a request before it is sent, optionally cancelling it. - fn call(&mut self, request: crate::Request<()>) -> Result, Status>; + fn intercept(&mut self, request: crate::Request<()>) -> Result, Status>; } impl Interceptor for F where F: FnMut(crate::Request<()>) -> Result, Status>, { - fn call(&mut self, request: crate::Request<()>) -> Result, Status> { + fn intercept(&mut self, request: crate::Request<()>) -> Result, Status> { self(request) } } @@ -140,7 +140,7 @@ where match self .interceptor - .call(crate::Request::from_parts(metadata, extensions, ())) + .intercept(crate::Request::from_parts(metadata, extensions, ())) { Ok(req) => { let (metadata, extensions, _) = req.into_parts();