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

Function trim_node_depth

packages/server/src/api/routes.rs:4885–4898  ·  view source on GitHub ↗
(node: &mut Value, depth: usize, max_depth: usize)

Source from the content-addressed store, hash-verified

4883}
4884
4885fn trim_node_depth(node: &mut Value, depth: usize, max_depth: usize) {
4886 let Some(object) = node.as_object_mut() else {
4887 return;
4888 };
4889 if depth >= max_depth {
4890 object.insert("children".to_owned(), Value::Array(Vec::new()));
4891 return;
4892 }
4893 if let Some(children) = object.get_mut("children").and_then(Value::as_array_mut) {
4894 for child in children {
4895 trim_node_depth(child, depth + 1, max_depth);
4896 }
4897 }
4898}
4899
4900fn empty_accessibility_tree(
4901 source: &str,

Callers 1

trim_tree_depthFunction · 0.85

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected