pub struct InterceptorFn<OnReq, OnResp> {
pub on_request: OnReq,
pub on_response: OnResp,
}Expand description
Utility to define interceptor using function pointers
Fields§
§on_request: OnReqCallback to be called on incoming request
on_response: OnRespCallback to be called on response ready
Trait Implementations§
Source§impl<OnReq: Clone, OnResp: Clone> Clone for InterceptorFn<OnReq, OnResp>
impl<OnReq: Clone, OnResp: Clone> Clone for InterceptorFn<OnReq, OnResp>
Source§fn clone(&self) -> InterceptorFn<OnReq, OnResp>
fn clone(&self) -> InterceptorFn<OnReq, OnResp>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<OnReq: Fn(&mut MetadataMap, &mut Extensions) -> Option<Status>, OnResp: Fn(Code, &mut HeaderMap, &Extensions)> Interceptor for InterceptorFn<OnReq, OnResp>
impl<OnReq: Fn(&mut MetadataMap, &mut Extensions) -> Option<Status>, OnResp: Fn(Code, &mut HeaderMap, &Extensions)> Interceptor for InterceptorFn<OnReq, OnResp>
Source§fn on_request(
&self,
headers: &mut MetadataMap,
extensions: &mut Extensions,
) -> Option<Status>
fn on_request( &self, headers: &mut MetadataMap, extensions: &mut Extensions, ) -> Option<Status>
Callback on incoming request, allowing you to modify headers or extensions Read more
Source§fn on_response(
&self,
status: Code,
headers: &mut HeaderMap,
extensions: &Extensions,
)
fn on_response( &self, status: Code, headers: &mut HeaderMap, extensions: &Extensions, )
Callback when response is being returned
Auto Trait Implementations§
impl<OnReq, OnResp> Freeze for InterceptorFn<OnReq, OnResp>
impl<OnReq, OnResp> RefUnwindSafe for InterceptorFn<OnReq, OnResp>where
OnReq: RefUnwindSafe,
OnResp: RefUnwindSafe,
impl<OnReq, OnResp> Send for InterceptorFn<OnReq, OnResp>
impl<OnReq, OnResp> Sync for InterceptorFn<OnReq, OnResp>
impl<OnReq, OnResp> Unpin for InterceptorFn<OnReq, OnResp>
impl<OnReq, OnResp> UnwindSafe for InterceptorFn<OnReq, OnResp>where
OnReq: UnwindSafe,
OnResp: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request