zen_engine/nodes/
result.rs1use crate::model::DecisionNode;
2use serde::{Deserialize, Serialize};
3use std::fmt::{Display, Formatter};
4use std::sync::Arc;
5use thiserror::Error;
6use zen_expression::variable::Variable;
7
8#[derive(Debug, Deserialize, Serialize)]
9#[serde(rename_all = "camelCase")]
10pub struct NodeResponse {
11 pub output: Variable,
12 pub trace_data: Option<Variable>,
13}
14
15#[derive(Debug, Serialize, Clone)]
16pub struct NodeRequest {
17 pub input: Variable,
18 pub iteration: u8,
19 pub node: Arc<DecisionNode>,
20}
21
22pub type NodeResult = Result<NodeResponse, NodeError>;
23
24#[derive(Debug, Error)]
25pub struct NodeError {
26 pub node_id: Arc<str>,
27 pub trace: Option<Variable>,
28 pub source: Box<dyn std::error::Error>,
29}
30
31impl Display for NodeError {
32 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
33 write!(f, "{}", self.source)
34 }
35}