pub struct InterceptorChain { /* private fields */ }Expand description
Chain of request and response interceptors.
Manages the execution of multiple interceptors in the correct order:
- Request interceptors: executed in registration order (first registered = first executed)
- Response interceptors: executed in reverse order (last registered = first executed)
Implementations§
Source§impl InterceptorChain
impl InterceptorChain
Sourcepub fn new() -> InterceptorChain
pub fn new() -> InterceptorChain
Create a new empty interceptor chain.
Sourcepub fn add_request_interceptor<I>(&mut self, interceptor: I)where
I: RequestInterceptor,
pub fn add_request_interceptor<I>(&mut self, interceptor: I)where
I: RequestInterceptor,
Add a request interceptor to the chain.
Interceptors are executed in the order they are added.
Sourcepub fn add_response_interceptor<I>(&mut self, interceptor: I)where
I: ResponseInterceptor,
pub fn add_response_interceptor<I>(&mut self, interceptor: I)where
I: ResponseInterceptor,
Add a response interceptor to the chain.
Interceptors are executed in reverse order (last added = first executed after handler).
Sourcepub fn request_interceptor_count(&self) -> usize
pub fn request_interceptor_count(&self) -> usize
Get the number of request interceptors.
Sourcepub fn response_interceptor_count(&self) -> usize
pub fn response_interceptor_count(&self) -> usize
Get the number of response interceptors.
Sourcepub fn intercept_request(&self, request: Request) -> Request
pub fn intercept_request(&self, request: Request) -> Request
Execute all request interceptors on the given request.
Interceptors are executed in registration order. Each interceptor receives the output of the previous one.
Trait Implementations§
Source§impl Clone for InterceptorChain
impl Clone for InterceptorChain
Source§fn clone(&self) -> InterceptorChain
fn clone(&self) -> InterceptorChain
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 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 !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