pub struct InterceptorChain { /* private fields */ }Expand description
An ordered list of CallInterceptors applied to every request.
Interceptors run in registration order for before and reverse order for
after (outermost wraps innermost).
Implementations§
Source§impl InterceptorChain
impl InterceptorChain
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty InterceptorChain.
Sourcepub fn push<I: CallInterceptor>(&mut self, interceptor: I)
pub fn push<I: CallInterceptor>(&mut self, interceptor: I)
Adds an interceptor to the end of the chain.
Sourcepub async fn run_before(&self, req: &mut ClientRequest) -> ClientResult<()>
pub async fn run_before(&self, req: &mut ClientRequest) -> ClientResult<()>
Runs all before hooks in registration order.
§Errors
Returns the first error returned by any interceptor in the chain.
Sourcepub async fn run_after(&self, resp: &ClientResponse) -> ClientResult<()>
pub async fn run_after(&self, resp: &ClientResponse) -> ClientResult<()>
Runs all after hooks in reverse registration order.
§Errors
Returns the first error returned by any interceptor in the chain.
Trait Implementations§
Source§impl Debug for InterceptorChain
impl Debug for InterceptorChain
Source§impl Default for InterceptorChain
impl Default for InterceptorChain
Source§fn default() -> InterceptorChain
fn default() -> InterceptorChain
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InterceptorChain
impl !RefUnwindSafe for InterceptorChain
impl Send for InterceptorChain
impl Sync for InterceptorChain
impl Unpin for InterceptorChain
impl UnsafeUnpin for InterceptorChain
impl !UnwindSafe for InterceptorChain
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> 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