Recursively builds the render tree structure. Traverses the execution plan and creates corresponding render nodes while maintaining proper positioning and parent-child relationships. # Arguments `result` - The render tree being constructed `plan` - Current execution plan node being processed `x` - Horizontal position in the tree `y` - Vertical position in the tree # Returns The width of the subt
(
result: &mut RenderTree,
plan: &dyn ExecutionPlan,
x: usize,
y: usize,
)
| 190 | /// # Returns |
| 191 | /// * The width of the subtree rooted at the current node |
| 192 | fn create_tree_recursive( |
| 193 | result: &mut RenderTree, |
| 194 | plan: &dyn ExecutionPlan, |
| 195 | x: usize, |
| 196 | y: usize, |
| 197 | ) -> usize { |
| 198 | let display_info = fmt_display(plan).to_string(); |
| 199 | let mut extra_info = HashMap::new(); |
| 200 | |
| 201 | // Parse the key-value pairs from the formatted string. |
| 202 | // See DisplayFormatType::TreeRender for details |
| 203 | for line in display_info.lines() { |
| 204 | if let Some((key, value)) = line.split_once('=') { |
| 205 | extra_info.insert(key.to_string(), value.to_string()); |
| 206 | } else { |
| 207 | extra_info.insert(line.to_string(), "".to_string()); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | let mut node = RenderTreeNode::new(plan.name().to_string(), extra_info); |
| 212 | |
| 213 | let children = plan.children(); |
| 214 | |
| 215 | if children.is_empty() { |
| 216 | result.set_node(x, y, Arc::new(node)); |
| 217 | return 1; |
| 218 | } |
| 219 | |
| 220 | let mut width = 0; |
| 221 | for child in children { |
| 222 | let child_x = x + width; |
| 223 | let child_y = y + 1; |
| 224 | node.add_child_position(child_x, child_y); |
| 225 | width += create_tree_recursive(result, child.as_ref(), child_x, child_y); |
| 226 | } |
| 227 | |
| 228 | result.set_node(x, y, Arc::new(node)); |
| 229 | |
| 230 | width |
| 231 | } |
no test coverage detected
searching dependent graphs…