d3ne/
target.rs

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