(
node: &'a Value,
selector: &ElementSelector,
root_width: f64,
root_height: f64,
matches: &mut Vec<MatchedElement<'a>>,
)
| 83 | } |
| 84 | |
| 85 | fn 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 | |
| 106 | fn element_matches(node: &Value, selector: &ElementSelector) -> bool { |
| 107 | if let Some(element_type) = &selector.element_type { |
no test coverage detected