pub struct InMemoryQueryBus { /* private fields */ }Expand description
基于内存的 QueryBus 实现
- 通过 TypeId 注册不同 Query 对应的 Handler
- 以类型擦除方式调度,并在调用端进行结果还原
Implementations§
Source§impl InMemoryQueryBus
impl InMemoryQueryBus
Sourcepub fn registered_queries(&self) -> Vec<&'static str>
pub fn registered_queries(&self) -> Vec<&'static str>
获取已注册的查询类型名列表(只读视图)
Trait Implementations§
Source§impl Default for InMemoryQueryBus
impl Default for InMemoryQueryBus
Source§impl QueryBus for InMemoryQueryBus
impl QueryBus for InMemoryQueryBus
Source§fn dispatch<'life0, 'life1, 'async_trait, Q, R>(
&'life0 self,
ctx: &'life1 AppContext,
q: Q,
) -> Pin<Box<dyn Future<Output = Result<R, AppError>> + Send + 'async_trait>>
fn dispatch<'life0, 'life1, 'async_trait, Q, R>( &'life0 self, ctx: &'life1 AppContext, q: Q, ) -> Pin<Box<dyn Future<Output = Result<R, AppError>> + Send + 'async_trait>>
Dispatch a query and return its associated result. Read more
Auto Trait Implementations§
impl Freeze for InMemoryQueryBus
impl !RefUnwindSafe for InMemoryQueryBus
impl Send for InMemoryQueryBus
impl Sync for InMemoryQueryBus
impl Unpin for InMemoryQueryBus
impl UnsafeUnpin for InMemoryQueryBus
impl !UnwindSafe for InMemoryQueryBus
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