mm1_core/context/
call.rs

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
use std::future::Future;

pub trait Call<To, Msg>: Send
where
    To: Send,
    Msg: Send,
{
    type Outcome: Send;

    fn call(&mut self, to: To, msg: Msg) -> impl Future<Output = Self::Outcome> + Send;
}

pub trait TryCall<To, Msg>: Call<To, Msg, Outcome = Result<Self::CallOk, Self::CallError>>
where
    To: Send,
    Msg: Send,
{
    type CallOk: Send;
    type CallError: Send;
}
impl<T, To, Msg, Ok, Err> TryCall<To, Msg> for T
where
    T: Call<To, Msg, Outcome = Result<Ok, Err>>,
    To: Send,
    Msg: Send,
    Ok: Send,
    Err: Send,
{
    type CallError = Err;
    type CallOk = Ok;
}