mediator_sys/mediator/synchronous/basic/
interface.rs1use std::{fmt::Debug, sync::mpsc::TryRecvError};
2
3use crate::mediator::listener::Listener;
4
5pub trait SyncMediatorInternal<Ev: Debug> {
7 fn publish(&self, event: Ev);
8}
9
10pub trait SyncMediatorInternalHandle<Ev: Debug> {
13 fn send<Req>(&self, req: Req)
14 where
15 Self: RequestHandler<Req, Ev>;
16}
17
18pub trait SyncMediatorInternalNext {
21 fn next(&self) -> Result<(), TryRecvError>;
22}
23
24pub trait RequestHandler<Req, Res> {
27 fn handle(&self, req: Req);
28}
29
30pub trait BasicMediatorBuilderInterface<M, Ev> {
33 fn add_listener<F>(self, f: F) -> Self
34 where
35 F: Listener<Ev>,
36 Ev: Debug;
37}