Skip to main content

CallInterceptor

Trait CallInterceptor 

Source
pub trait CallInterceptor: Send + Sync {
    // Required methods
    fn extension(&self) -> &str;
    fn matches(&self, request: &HookRequest) -> Result<bool>;
    fn modify_request(&self, request: &mut HookRequest) -> Result<()>;
    fn modify_response(
        &self,
        request: &HookRequest,
        response: &mut HookResponse,
    ) -> Result<()>;
}
Expand description

One extension’s interceptor.

Required Methods§

Source

fn extension(&self) -> &str

The extension’s name, which every error this interceptor causes carries.

Source

fn matches(&self, request: &HookRequest) -> Result<bool>

Whether this interceptor sees request, the call as the interceptors before it left it. Only the interceptors that match a call see its request and its response. An error fails the call, as a failing modify_request does.

Source

fn modify_request(&self, request: &mut HookRequest) -> Result<()>

Source

fn modify_response( &self, request: &HookRequest, response: &mut HookResponse, ) -> Result<()>

Changes response, error responses included. request is the request as sent. An error fails the call for good, even one the interceptor marked retryable.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§