MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / trim_tree_depth

Function trim_tree_depth

packages/server/src/api/routes.rs:4873–4883  ·  view source on GitHub ↗
(mut snapshot: Value, max_depth: Option<usize>)

Source from the content-addressed store, hash-verified

4871}
4872
4873fn 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
4885fn trim_node_depth(node: &mut Value, depth: usize, max_depth: usize) {
4886 let Some(object) = node.as_object_mut() else {

Calls 1

trim_node_depthFunction · 0.85