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

Function collect_matching_elements

packages/server/src/main/tap_target.rs:85–104  ·  view source on GitHub ↗
(
    node: &'a Value,
    selector: &ElementSelector,
    root_width: f64,
    root_height: f64,
    matches: &mut Vec<MatchedElement<'a>>,
)

Source from the content-addressed store, hash-verified

83}
84
85fn collect_matching_elements<'a>(
86 node: &'a Value,
87 selector: &ElementSelector,
88 root_width: f64,
89 root_height: f64,
90 matches: &mut Vec<MatchedElement<'a>>,
91) {
92 if element_matches(node, selector) {
93 matches.push(MatchedElement {
94 node,
95 root_width,
96 root_height,
97 });
98 }
99 if let Some(children) = node.get("children").and_then(Value::as_array) {
100 for child in children {
101 collect_matching_elements(child, selector, root_width, root_height, matches);
102 }
103 }
104}
105
106fn element_matches(node: &Value, selector: &ElementSelector) -> bool {
107 if let Some(element_type) = &selector.element_type {

Callers 1

find_element_tap_targetFunction · 0.85

Calls 2

element_matchesFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected