LifecycleHook

Trait LifecycleHook 

Source
pub trait LifecycleHook<Req, Resp>: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn execute_request<'a>(
        &'a self,
        req: Req,
    ) -> Pin<Box<dyn Future<Output = Result<HookResult<Req, Resp>, String>> + Send + 'a>>;
    fn execute_response<'a>(
        &'a self,
        resp: Resp,
    ) -> Pin<Box<dyn Future<Output = Result<HookResult<Resp, Resp>, String>> + Send + 'a>>;
}
Expand description

Trait for lifecycle hooks on native targets (Send + Sync, Send futures).

Required Methods§

Source

fn name(&self) -> &str

Hook name for debugging and error messages

Source

fn execute_request<'a>( &'a self, req: Req, ) -> Pin<Box<dyn Future<Output = Result<HookResult<Req, Resp>, String>> + Send + 'a>>

Execute hook with a request

Source

fn execute_response<'a>( &'a self, resp: Resp, ) -> Pin<Box<dyn Future<Output = Result<HookResult<Resp, Resp>, String>> + Send + 'a>>

Execute hook with a response

Implementors§