Skip to main content

BoxedDispatchFn

Type Alias BoxedDispatchFn 

Source
pub type BoxedDispatchFn = fn(Arc<ServiceProvider>, Box<dyn Any + Send>) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, Error>> + Send>>;
Expand description

Type-erased dispatch function for one request type.

#[handler] generates one per impl IRequestHandler<T, R>: it downcasts the boxed request to T, runs the typed dispatch (pipeline + handler) and boxes the R response. This is what lets IMediator::send_boxed work through Arc<dyn IMediator> without knowing T/R at the call site.