MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / node_value

Method node_value

packages/server/src/devtools.rs:1706–1745  ·  view source on GitHub ↗
(&self, node_id: u64, depth: i64)

Source from the content-addressed store, hash-verified

1704 }
1705
1706 fn node_value(&self, node_id: u64, depth: i64) -> Value {
1707 let Some(node) = self.nodes.get(&node_id) else {
1708 return json!({
1709 "nodeId": node_id,
1710 "backendNodeId": node_id,
1711 "nodeType": 1,
1712 "nodeName": "UNKNOWN",
1713 "localName": "unknown",
1714 "nodeValue": "",
1715 "childNodeCount": 0,
1716 "attributes": [],
1717 });
1718 };
1719 let node_name = node_name(&node.node);
1720 let mut value = json!({
1721 "nodeId": node.node_id,
1722 "backendNodeId": node.backend_node_id,
1723 "nodeType": 1,
1724 "nodeName": node_name.to_ascii_uppercase(),
1725 "localName": node_name.to_ascii_lowercase(),
1726 "nodeValue": "",
1727 "childNodeCount": node.children.len(),
1728 "attributes": node_attributes(&node.node, node.inspector_id.as_deref()),
1729 });
1730 if depth != 0 {
1731 let next_depth = if depth < 0 { -1 } else { depth - 1 };
1732 if let Some(object) = value.as_object_mut() {
1733 object.insert(
1734 "children".to_owned(),
1735 Value::Array(
1736 node.children
1737 .iter()
1738 .map(|child_id| self.node_value(*child_id, next_depth))
1739 .collect(),
1740 ),
1741 );
1742 }
1743 }
1744 value
1745 }
1746
1747 fn remote_node_object(&self, node_id: u64) -> Value {
1748 let description = self

Callers 3

append_flattenedMethod · 0.80
describe_nodeMethod · 0.80
children_for_nodeMethod · 0.80

Calls 3

node_nameFunction · 0.85
insertMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected