floxide_core/node.rs
1use crate::{context::Context, transition::Transition};
2use async_trait::async_trait;
3
4/// A node takes an input and a context, and returns a transition.
5#[async_trait]
6pub trait Node<C: Context = ()>: Send + Sync {
7 /// Input type for the node
8 type Input: Send + Sync;
9 /// Output type produced by the node
10 type Output: Send + Sync;
11
12 /// Process an input value within the given context, producing a transition
13 async fn process(
14 &self,
15 ctx: &C,
16 input: Self::Input,
17 ) -> Result<Transition<Self::Output>, crate::error::FloxideError>;
18}