rill_engine/tracers/
meio_addon.rs1use super::tracer::Tracer;
4use meio::{Action, ActionHandler, Actor, Context};
5use rill_protocol::flow::core::{ActionEnvelope, Flow};
6
7pub struct TracerAction<T: Flow, Tag = ()> {
9 pub envelope: ActionEnvelope<T>,
11 pub tag: Tag,
13}
14
15impl<T: Flow, Tag: Send + 'static> Action for TracerAction<T, Tag> {}
16
17impl<T: Flow> Tracer<T> {
18 pub fn forward<A: Actor, Tag>(&self, tag: Tag, ctx: &mut Context<A>)
20 where
21 A: ActionHandler<TracerAction<T, Tag>>,
22 Tag: Clone + Send + Sync + 'static,
23 {
24 let addr = ctx.address().clone();
25 self.async_callback(move |envelope| {
26 let mut addr = addr.clone();
27 let tag = tag.clone();
28 async move {
29 let msg = TracerAction { envelope, tag };
30 addr.act(msg).await
31 }
32 });
33 }
34}