pub struct Mediator { /* private fields */ }Expand description
Default implementation of IMediator.
Holds the host’s root ServiceProvider and its compiled handler registry.
Each send call creates a per-request scope, so Scoped services (e.g.
DbContext) are resolved fresh and released with the scope by rust-dix.
Implementations§
Source§impl Mediator
impl Mediator
Sourcepub fn new(
provider: Arc<ServiceProvider>,
handler_cache: Arc<HandlerCache>,
) -> Mediator
pub fn new( provider: Arc<ServiceProvider>, handler_cache: Arc<HandlerCache>, ) -> Mediator
Create a mediator over a host’s provider and compiled handler registry.
Host::build constructs these handles once;
IServiceCollectionExt::add_mediator
registers a transient mediator that resolves them from DI, so handler
code can inject Arc<dyn IMediator> / Mediator and use the same path
as in-process calls.
Trait Implementations§
Source§impl IMediator for Mediator
impl IMediator for Mediator
Source§fn send<'life0, 'async_trait, T, R>(
&'life0 self,
req: T,
) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>>
fn send<'life0, 'async_trait, T, R>( &'life0 self, req: T, ) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>>
Send a request and return its structured response.
Auto Trait Implementations§
impl !RefUnwindSafe for Mediator
impl !UnwindSafe for Mediator
impl Forget for Mediator
impl Freeze for Mediator
impl Move for Mediator
impl Send for Mediator
impl Sync for Mediator
impl Unpin for Mediator
impl UnsafeUnpin for Mediator
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