daedalus_runtime/executor/
handler.rs1use super::errors::NodeError;
2use crate::io::NodeIo;
3use crate::state::ExecutionContext;
4
5pub trait NodeHandler: Send + Sync {
23 fn run(
24 &self,
25 node: &crate::plan::RuntimeNode,
26 ctx: &ExecutionContext,
27 io: &mut NodeIo,
28 ) -> Result<(), NodeError>;
29}
30
31impl<F> NodeHandler for F
32where
33 F: Fn(&crate::plan::RuntimeNode, &ExecutionContext, &mut NodeIo) -> Result<(), NodeError>
34 + Send
35 + Sync,
36{
37 fn run(
38 &self,
39 node: &crate::plan::RuntimeNode,
40 ctx: &ExecutionContext,
41 io: &mut NodeIo,
42 ) -> Result<(), NodeError> {
43 (self)(node, ctx, io)
44 }
45}