(mut snapshot: Value, max_depth: Option<usize>)
| 4871 | } |
| 4872 | |
| 4873 | fn trim_tree_depth(mut snapshot: Value, max_depth: Option<usize>) -> Value { |
| 4874 | let Some(max_depth) = max_depth else { |
| 4875 | return snapshot; |
| 4876 | }; |
| 4877 | if let Some(roots) = snapshot.get_mut("roots").and_then(Value::as_array_mut) { |
| 4878 | for root in roots { |
| 4879 | trim_node_depth(root, 0, max_depth); |
| 4880 | } |
| 4881 | } |
| 4882 | snapshot |
| 4883 | } |
| 4884 | |
| 4885 | fn trim_node_depth(node: &mut Value, depth: usize, max_depth: usize) { |
| 4886 | let Some(object) = node.as_object_mut() else { |