devtools/actors/
blackboxing.rs1use malloc_size_of_derive::MallocSizeOf;
6
7use crate::ActorMsg;
8use crate::actor::{Actor, ActorEncode, ActorRegistry};
9
10#[derive(MallocSizeOf)]
11pub(crate) struct BlackboxingActor {
12 name: String,
13}
14
15impl Actor for BlackboxingActor {
16 fn name(&self) -> String {
17 self.name.clone()
18 }
19}
20
21impl BlackboxingActor {
22 pub fn register(registry: &ActorRegistry) -> String {
23 let name = registry.new_name::<Self>();
24 let actor = Self { name: name.clone() };
25 registry.register::<Self>(actor);
26 name
27 }
28}
29
30impl ActorEncode<ActorMsg> for BlackboxingActor {
31 fn encode(&self, _: &ActorRegistry) -> ActorMsg {
32 ActorMsg { actor: self.name() }
33 }
34}