Skip to main content

rib/interpreter/
interpreter_input.rs

1use crate::ValueAndType;
2use std::collections::HashMap;
3
4// Acts as the structure to hold the global input values to the Rib script
5#[derive(Debug, Default, Clone)]
6pub struct RibInput {
7    pub input: HashMap<String, ValueAndType>,
8}
9
10impl RibInput {
11    pub fn new(input: HashMap<String, ValueAndType>) -> RibInput {
12        RibInput { input }
13    }
14
15    pub fn merge(&self, other: RibInput) -> RibInput {
16        let mut cloned = self.clone();
17        cloned.input.extend(other.input);
18        cloned
19    }
20}