pub trait Hook<T: Table + Bind + Sync>: Sync + Send {
// Required method
fn stage(&self) -> HookStage;
// Provided method
fn apply<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 Query<T>,
input: &'life2 mut HookInput<'life3, T>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Expand description
A trait defining a hook for query execution.
Implementors of this trait can define custom logic to be executed at a specific stage of the query lifecycle. The trait provides a method to specify the stage at which the hook should be applied and another method to implement the hook’s logic.
Required Methods§
Provided Methods§
Sourcefn apply<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 Query<T>,
input: &'life2 mut HookInput<'life3, T>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn apply<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 Query<T>,
input: &'life2 mut HookInput<'life3, T>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Asynchronously applies the hook logic to a given query context and input.