1use std::collections::HashMap;
2
3use crate::change::Change;
4use crate::input;
5use crate::input::Input;
6
7#[derive(Debug, Default, Clone)]
8pub struct State {
9 pub inputs: HashMap<String, Input>,
10 changes: Vec<Change>,
11}
12
13impl State {
14 pub fn add_change(&mut self, change: Change) {
15 self.changes.push(change);
16 }
17 pub fn add_input(&mut self, key: &str, input: Input) {
18 self.inputs.insert(key.into(), input);
19 }
20 pub fn add_follows(&mut self, key: &str, follows: input::Follows) {
21 if let Some(input) = self.inputs.get_mut(key) {
22 input.follows.push(follows);
23 }
24 }
25}