use async_trait::async_trait;
use std::{fmt::Debug, sync::mpsc::TryRecvError};
#[async_trait]
pub trait AsyncMediatorInternal<Ev: Debug> {
#[allow(missing_docs)]
async fn publish(&self, event: Ev);
}
#[async_trait]
pub trait AsyncMediatorInternalHandle<Ev: Debug> {
#[allow(missing_docs)]
async fn send<Req>(&self, req: Req)
where
Req: Send,
Self: AsyncRequestHandler<Req, Ev>;
}
#[async_trait]
pub trait AsyncMediatorInternalNext {
#[allow(missing_docs)]
async fn next(&self) -> Result<(), TryRecvError>;
}
#[async_trait]
pub trait AsyncRequestHandler<Req, Res>
where
Self: Sync,
{
#[allow(missing_docs)]
async fn handle(&self, req: Req);
}