pub trait ControllerHandler: Send + Sync {
// Required method
fn call<'a>(
&'a self,
ctx: &'a mut Context,
) -> Pin<Box<dyn Future<Output = ControllerResult> + Send + 'a>>;
}Expand description
Trait for controller functions that can be stored in the registry.
Required Methods§
fn call<'a>( &'a self, ctx: &'a mut Context, ) -> Pin<Box<dyn Future<Output = ControllerResult> + Send + 'a>>
Implementors§
impl<F> ControllerHandler for F
Blanket implementation for named async functions that take &mut Context.
Use named async functions (not closures) for controller registration:
ⓘ
async fn normalize_email(ctx: &mut Context) -> ControllerResult {
// modify ctx.input...
Ok(())
}
map.register("users", "normalize_email", normalize_email);