pub struct HandlerRegistration {
pub req_type_id: TypeId,
pub req_type_name: &'static str,
pub factory: fn(&dyn IServiceResolver) -> Box<dyn Any + Send>,
pub call: fn(Box<dyn Any + Send>, Box<dyn Any + Send>) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, Error>> + Send>>,
}Expand description
Handler registration collected at compile time.
Each #[handler] annotation submits one of these to inventory.
The factory is called per request with the request-scoped IServiceResolver
so it can resolve Scoped dependencies (e.g. DbContext) via get_owned.
The result is an owned, type-erased handler — no Arc<dyn Trait> caching,
so handle(&mut self) works without interior mutability.
Fields§
§req_type_id: TypeIdCompile-time type id of the request type — primary dispatch key.
req_type_name: &'static strRequest type name (e.g., “HelloRequest”) — used for diagnostics and route matching.
factory: fn(&dyn IServiceResolver) -> Box<dyn Any + Send>Constructs a fresh owned handler, boxed as Box<dyn Any + Send>.
Called per-request with the per-request scope as resolver.
call: fn(Box<dyn Any + Send>, Box<dyn Any + Send>) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, Error>> + Send>>Type-erased call bridge: receives the owned handler and the boxed request,
invokes handle(&mut self, req), and returns the boxed response.