pub mod default;
pub mod dispatch;
pub mod pipeline;
pub use default::Mediator;
pub use dispatch::dispatch;
pub use pipeline::build_chain as build_pipeline_chain;
use crate::error::Result;
pub trait IRequest<TResponse>: Send + 'static
where
TResponse: serde::Serialize + Send + 'static,
{
}
pub trait IEventRequest: Clone + Send + 'static {}
#[async_trait::async_trait]
pub trait IMediator: Send + Sync {
async fn send<T, R>(&self, req: T) -> Result<R>
where
T: IRequest<R> + Send + 'static,
R: serde::Serialize + Send + 'static;
async fn publish<T: IEventRequest>(&self, event: T) -> Result<()>;
}