mm1_core/context/
call.rs

1use std::future::Future;
2
3pub trait Call<To, Msg>: Send
4where
5    To: Send,
6    Msg: Send,
7{
8    type Outcome: Send;
9
10    fn call(&mut self, to: To, msg: Msg) -> impl Future<Output = Self::Outcome> + Send;
11}
12
13pub trait TryCall<To, Msg>: Call<To, Msg, Outcome = Result<Self::CallOk, Self::CallError>>
14where
15    To: Send,
16    Msg: Send,
17{
18    type CallOk: Send;
19    type CallError: Send;
20}
21impl<T, To, Msg, Ok, Err> TryCall<To, Msg> for T
22where
23    T: Call<To, Msg, Outcome = Result<Ok, Err>>,
24    To: Send,
25    Msg: Send,
26    Ok: Send,
27    Err: Send,
28{
29    type CallError = Err;
30    type CallOk = Ok;
31}