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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Definition of the current state of the graph modeled in the UI.
//!
//! # Example
//!
//! The following example represents a possible report returned from an
//! application instantiated via the [`Config`
//! example](../config/index.html#example). Note that it is not a valid rust
//! code, but an output of the `dbg!` macro.
//!
//! ```ignore
//! Report {
//!     nodes: [
//!         Node {
//!             id: "comment:0",
//!             class: "comment",
//!             data: {
//!                 "comment": String(
//!                     "Content of the comment block.",
//!                 ),
//!             },
//!         },
//!         Node {
//!             id: "oscillator:0",
//!             class: "oscillator",
//!             data: {
//!                 "switch": Bool(
//!                     true,
//!                 ),
//!                 "trigger": Bool(
//!                     false,
//!                 ),
//!                 "dropdown": String(
//!                     "triangle",
//!                 ),
//!                 "slider": F32(
//!                     7.5,
//!                 ),
//!             },
//!         },
//!         Node {
//!             id: "mixer:0",
//!             class: "mixer",
//!             data: {},
//!         },
//!     ],
//!     patches: [
//!         Patch {
//!             source: PinAddress {
//!                 node_id: "oscillator:0",
//!                 pin_class: "output",
//!             },
//!             destination: PinAddress {
//!                 node_id: "mixer:0",
//!                 pin_class: "input1",
//!             },
//!         },
//!     ],
//! }
//! ```

use crate::model::{Node, Patch};

/// Report is a structure holding information about the current "model" of the
/// graph represented in the UI. It does not report details about the widgets
/// that were used nor about positions of items on the canvas. It is limited to
/// the minimal amount of information needed to convert the state into a graph.
#[derive(PartialEq, Clone, Debug)]
pub struct Report {
    /// All instantiated nodes with their values set via widgets.
    pub nodes: Vec<Node>,
    /// List of all patches connecting node pins.
    pub patches: Vec<Patch>,
}