Calculates the required dimensions of the tree. This ensures we allocate enough space for the entire tree structure. # Arguments `plan` - The execution plan to measure # Returns A tuple of (width, height) representing the dimensions needed for the tree
(plan: &dyn ExecutionPlan)
| 141 | /// # Returns |
| 142 | /// * A tuple of (width, height) representing the dimensions needed for the tree |
| 143 | fn get_tree_width_height(plan: &dyn ExecutionPlan) -> (usize, usize) { |
| 144 | let children = plan.children(); |
| 145 | |
| 146 | // Leaf nodes take up 1x1 space |
| 147 | if children.is_empty() { |
| 148 | return (1, 1); |
| 149 | } |
| 150 | |
| 151 | let mut width = 0; |
| 152 | let mut height = 0; |
| 153 | |
| 154 | for child in children { |
| 155 | let (child_width, child_height) = get_tree_width_height(child.as_ref()); |
| 156 | width += child_width; |
| 157 | height = cmp::max(height, child_height); |
| 158 | } |
| 159 | |
| 160 | height += 1; |
| 161 | |
| 162 | (width, height) |
| 163 | } |
| 164 | |
| 165 | fn fmt_display(plan: &dyn ExecutionPlan) -> impl fmt::Display + '_ { |
| 166 | struct Wrapper<'a> { |
no test coverage detected
searching dependent graphs…