1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use std::{collections::HashMap, ops::Deref};
use serde_json::Value;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct InputConnection {
pub node: i64,
pub output: String,
pub data: Value
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Input {
pub connections: Vec<InputConnection>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct OutputConnection {
pub node: i64,
pub input: String,
pub data: Value
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Output {
pub connections: Vec<OutputConnection>,
}
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
pub struct Inputs(HashMap<String, Input>);
impl Inputs {
pub fn inner(&self) -> &HashMap<String, Input> {
&self.0
}
}
impl Deref for Inputs {
type Target = HashMap<String, Input>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
pub struct Outputs(HashMap<String, Output>);
impl Outputs {
pub fn inner(&self) -> &HashMap<String, Output> {
&self.0
}
}
impl Deref for Outputs {
type Target = HashMap<String, Output>;
fn deref(&self) -> &Self::Target {
&self.0
}
}