pub struct HandlerCache {
pub entries: HashMap<&'static str, HandlerEntry>,
pub entries_by_id: HashMap<TypeId, HandlerEntry>,
/* private fields */
}Expand description
Runtime registry of compiled handler registrations.
Built at startup from HandlerRegistration inventory items.
Maps request type name to handler entry (factory + call bridge).
Unlike the previous design, entries do not cache a handler instance: the factory is invoked per request with the request-scoped resolver so Scoped dependencies (DbContext) are freshly owned each time.
Fields§
§entries: HashMap<&'static str, HandlerEntry>§entries_by_id: HashMap<TypeId, HandlerEntry>Implementations§
Source§impl HandlerCache
impl HandlerCache
Sourcepub fn get(&self, req_type_name: &str) -> Option<&HandlerEntry>
pub fn get(&self, req_type_name: &str) -> Option<&HandlerEntry>
Look up a handler entry by request type name (route / OpenAPI diagnostics).
Sourcepub fn get_by_type_id(&self, type_id: TypeId) -> Option<&HandlerEntry>
pub fn get_by_type_id(&self, type_id: TypeId) -> Option<&HandlerEntry>
Look up a handler entry by request type id (Mediator / in-process dispatch).
Sourcepub fn boxed_dispatch(&self, type_id: TypeId) -> Option<BoxedDispatchFn>
pub fn boxed_dispatch(&self, type_id: TypeId) -> Option<BoxedDispatchFn>
Type-erased dispatch for IMediator::send_boxed.
None when the request type has no #[handler] (or a hand-written
handler registration without the boxed bridge).
Auto Trait Implementations§
impl Forget for HandlerCache
impl Freeze for HandlerCache
impl Move for HandlerCache
impl RefUnwindSafe for HandlerCache
impl Send for HandlerCache
impl Sync for HandlerCache
impl Unpin for HandlerCache
impl UnsafeUnpin for HandlerCache
impl UnwindSafe for HandlerCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more