runtara_workflow_stdlib/runtime/
context.rs1use serde_json::Value;
6use std::collections::HashMap;
7
8#[derive(Debug, Default)]
10pub struct RuntimeContext {
11 pub steps_context: HashMap<String, Value>,
13 pub input: Value,
15 pub connections: HashMap<String, Value>,
17}
18
19impl RuntimeContext {
20 pub fn new() -> Self {
22 Self::default()
23 }
24
25 pub fn with_input(input: Value) -> Self {
27 Self {
28 input,
29 ..Default::default()
30 }
31 }
32
33 pub fn get_step_result(&self, step_id: &str) -> Option<&Value> {
35 self.steps_context.get(step_id)
36 }
37
38 pub fn set_step_result(&mut self, step_id: String, value: Value) {
40 self.steps_context.insert(step_id, value);
41 }
42
43 pub fn get_input(&self) -> &Value {
45 &self.input
46 }
47}