mm1_node/runtime/
system.rs1use mm1_address::address::Address;
2
3use crate::runtime::context::ActorContext;
4use crate::runtime::runnable;
5
6mod protocol_system;
7
8#[derive(Debug, Default, Clone, Copy)]
9pub struct Local;
10
11#[derive(Debug, Clone, Copy)]
12pub struct Remote(#[allow(dead_code)] Address);
13
14pub struct RemoteRunnable(Address);
15
16impl Local {
17 pub fn actor<F>(actor: F) -> <Self as mm1_proto_system::System>::Runnable
18 where
19 F: runnable::ActorRunBoxed<ActorContext> + 'static,
20 {
21 runnable::boxed_from_fn(actor)
22 }
23}
24
25impl mm1_proto_system::System for Local {
26 type Runnable = runnable::BoxedRunnable<ActorContext>;
27}
28
29impl mm1_proto_system::System for Remote {
30 type Runnable = RemoteRunnable;
31}
32
33impl mm1_proto_system::Runnable for RemoteRunnable {
34 type System = Remote;
35
36 fn run_at(&self) -> Self::System {
37 Remote(self.0)
38 }
39}