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§
Sourcefn extension(&self) -> &str
fn extension(&self) -> &str
The extension’s name, which every error this interceptor causes carries.
Sourcefn matches(&self, request: &HookRequest) -> Result<bool>
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.
fn modify_request(&self, request: &mut HookRequest) -> Result<()>
Sourcefn modify_response(
&self,
request: &HookRequest,
response: &mut HookResponse,
) -> Result<()>
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".