smix-host-coord-resolver
Pure pipeline from (A11yNode tree, Selector) to a normalized (nx, ny)
tap coordinate. No I/O, no async, no injector awareness — the
host-side resolve step decoupled from whatever HID / Apple-native /
runner-side mechanism the caller wants to drive afterward.
This crate exists because the "fetch tree → resolve selector → compute
centroid → normalize into app frame" half of a typical iOS automation
tap call is generic across smix, maestro, Appium, and anyone building
their own automation framework. Extracting it gives you a stone-sized
dependency without dragging in a specific injector or runner-client.
Quickstart
use ;
use ;
use ;
#
let mut root = mk;
root.children.push;
let sel = Text ;
let = resolve_to_norm_coord.unwrap;
// Hand (nx, ny) to whatever injector you have:
// my_runner.tap_at_norm_coord(nx, ny).await?;
# assert!;
# assert!;
Error variants
HostResolveError is fine-grained so callers can map each variant to
their own failure type:
| Variant | Meaning |
|---|---|
NotFound |
selector matched nothing in the tree (after visibility filter) |
EmptyMatchedFrame |
matched node has zero-or-negative w or h |
UnknownAppFrame |
tree.bounds has zero-or-negative w or h |
CentroidOutOfFrame { nx, ny } |
computed normalized coord is outside (0, 1) |
When to reach for this
| Use case | Pick |
|---|---|
| Building an iOS automation library and want host-side resolve as a stone | smix-host-coord-resolver |
Already use smix-selector-resolver and want the centroid step too |
smix-host-coord-resolver |
Need a full driver with tap / fill / scroll semantics + retry |
use smix-driver (consumes this stone) |
| Doing physical-coord tap (not normalized) | normalize by your viewport first, then use this |
Scope
- ✅ Pure function
fn resolve_to_norm_coord(tree, selector) -> Result<(f64, f64), _> - ✅ Reuses
smix-selector-resolverfor the tree walk - ✅ Centroid + normalize math in
(0, 1)app-frame coordinates - ❌ No async, no I/O, no injector
- ❌ No retry / implicit wait — that's
smix-driver's job
License
Dual-licensed under either:
at your option.