pub trait IMediator: Send + Sync {
// Required methods
fn send<'life0, 'async_trait, T, R>(
&'life0 self,
req: T,
) -> Pin<Box<dyn Future<Output = Result<R, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
T: IRequest<R> + Send + 'static + 'async_trait,
R: Serialize + Send + 'static + 'async_trait,
Self: 'async_trait;
fn publish<'life0, 'async_trait, T>(
&'life0 self,
event: T,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
T: 'async_trait + IEventRequest,
Self: 'async_trait;
}Expand description
The mediator dispatches requests to their handlers and publishes events to all registered handlers.
Analogous to MediatR’s IMediator.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".