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§
Sourcefn execute_request<'a>(
&'a self,
req: Req,
) -> Pin<Box<dyn Future<Output = Result<HookResult<Req, Resp>, String>> + Send + 'a>>
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
Sourcefn execute_response<'a>(
&'a self,
resp: Resp,
) -> Pin<Box<dyn Future<Output = Result<HookResult<Resp, Resp>, String>> + Send + 'a>>
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