Check that two given contexts contain the same data, i.e. graphs, nodes, names, parameters. Underlying structures that contain pointers (graphs, nodes) are compared by data they refer to. # Arguments `context1` - first context to compare `context2` - second context to compare # Returns `true` if the given contexts contain the same content, otherwise `false`
(context1: Context, context2: Context)
| 4714 | /// |
| 4715 | /// `true` if the given contexts contain the same content, otherwise `false` |
| 4716 | pub fn contexts_deep_equal(context1: Context, context2: Context) -> bool { |
| 4717 | let body1 = context1.body.borrow(); |
| 4718 | let body2 = context2.body.borrow(); |
| 4719 | if body1.finalized != body2.finalized { |
| 4720 | return false; |
| 4721 | } |
| 4722 | if body1.graphs_names != body2.graphs_names { |
| 4723 | return false; |
| 4724 | } |
| 4725 | if body1.nodes_names != body2.nodes_names { |
| 4726 | return false; |
| 4727 | } |
| 4728 | if body1.nodes_annotations != body2.nodes_annotations { |
| 4729 | return false; |
| 4730 | } |
| 4731 | if body1.graphs_annotations != body2.graphs_annotations { |
| 4732 | return false; |
| 4733 | } |
| 4734 | if body1.graphs.len() != body2.graphs.len() { |
| 4735 | return false; |
| 4736 | } |
| 4737 | for i in 0..body1.graphs.len() { |
| 4738 | if !graphs_deep_equal(body1.graphs[i].clone(), body2.graphs[i].clone()) { |
| 4739 | return false; |
| 4740 | } |
| 4741 | } |
| 4742 | body1.main_graph.clone().map(|g| g.upgrade().get_id()) |
| 4743 | == body2.main_graph.clone().map(|g| g.upgrade().get_id()) |
| 4744 | } |
| 4745 | |
| 4746 | // Pass the node name of `in_node` to `out_node` if it is present. |
| 4747 | pub(crate) fn copy_node_name(in_node: Node, out_node: Node) -> Result<()> { |
no test coverage detected