ClientHooks

Trait ClientHooks 

Source
pub trait ClientHooks<Inner = ()>
where Self: ClientInfo<Inner>,
{ // Provided methods async fn pre<E>( &self, request: &mut Request, info: &OperationInfo, ) -> Result<(), Error<E>> { ... } async fn post<E>( &self, result: &Result<Response>, info: &OperationInfo, ) -> Result<(), Error<E>> { ... } async fn exec( &self, request: Request, info: &OperationInfo, ) -> Result<Response> { ... } }
Expand description

Interface for changing the behavior of generated clients. All clients implement this for &Client; to override the default behavior, implement some or all of the interfaces for the Client type (without the reference). This mechanism relies on so-called “auto-ref specialization”.

Provided Methods§

Source

async fn pre<E>( &self, request: &mut Request, info: &OperationInfo, ) -> Result<(), Error<E>>

Runs prior to the execution of the request. This may be used to modify the request before it is transmitted.

Source

async fn post<E>( &self, result: &Result<Response>, info: &OperationInfo, ) -> Result<(), Error<E>>

Runs after completion of the request.

Source

async fn exec(&self, request: Request, info: &OperationInfo) -> Result<Response>

Execute the request. Note that for almost any reasonable implementation this will include code equivalent to this:

        self.client().execute(request).await

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§