Skip to content

Commit ff29e86

Browse files
committed
wip: SerializableProcessingGraph
1 parent 2557844 commit ff29e86

File tree

3 files changed

+770
-1
lines changed

3 files changed

+770
-1
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Test file to verify serializable ProcessingGraph functionality
2+
use rust_photoacoustic::processing::{ProcessingGraph, SerializableProcessingGraph};
3+
use rust_photoacoustic::processing::nodes::{InputNode, ProcessingNode};
4+
5+
fn main() -> anyhow::Result<()> {
6+
// Create a simple processing graph
7+
let mut graph = ProcessingGraph::new();
8+
9+
// Add an input node
10+
let input_node = Box::new(InputNode::new("main_input".to_string()));
11+
graph.add_node(input_node)?;
12+
13+
// Convert to serializable format
14+
let serializable_graph: SerializableProcessingGraph = graph.into();
15+
16+
// Verify the conversion
17+
println!("Serializable Graph Created Successfully!");
18+
println!("Number of nodes: {}", serializable_graph.nodes.len());
19+
println!("Input node: {:?}", serializable_graph.input_node);
20+
println!("Graph is valid: {}", serializable_graph.is_valid);
21+
22+
if let Some(node) = serializable_graph.nodes.first() {
23+
println!("First node: {} (type: {})", node.id, node.node_type);
24+
println!("Accepts input types: {:?}", node.accepts_input_types);
25+
}
26+
27+
// Try serializing to JSON
28+
match serde_json::to_string_pretty(&serializable_graph) {
29+
Ok(json) => {
30+
println!("\nJSON serialization successful!");
31+
println!("JSON size: {} bytes", json.len());
32+
}
33+
Err(e) => {
34+
println!("JSON serialization failed: {}", e);
35+
}
36+
}
37+
38+
println!("\n✅ All serializable ProcessingGraph functionality working correctly!");
39+
40+
Ok(())
41+
}

0 commit comments

Comments
 (0)