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