Skip to main content

Crate smix_ffi

Crate smix_ffi 

Source
Expand description

§smix-ffi

UniFFI v0.29+ scaffolding crate for the smix cross-language SDK suite.

Each async endpoint exposes a sibling cancel_{op}(handle) for cancellation (UniFFI does not internally support coroutine cancellation).

§Build pipeline

# Workspace dev test (macOS host)
cargo build -p smix-ffi
cargo test  -p smix-ffi

# iOS sim slice
cargo build -p smix-ffi --target aarch64-apple-ios-sim --release

# Android sim slice
cargo ndk -t arm64-v8a -t x86_64 build --release

# Swift bindings generation
uniffi-bindgen-swift target/.../libsmix_ffi.a src/smix.udl --out-dir bindings/swift

# Kotlin bindings generation
uniffi-bindgen generate src/smix.udl --language kotlin --out-dir bindings/kotlin

# XCFramework packaging
xcodebuild -create-xcframework \
  -library target/aarch64-apple-ios-sim/release/libsmix_ffi.a -headers include \
  -output dist/SmixCoreFFI.xcframework

§Architecture

Wraps stone API (smix-selector + smix-selector-resolver + smix-screen) into UDL-defined FFI surface. UniFFI generates:

  • Rust scaffolding (C-ABI extern “C” fns + RustCallStatus + RustBuffer marshalling)
  • Swift bindings (typed Swift API with async throws + Sendable)
  • Kotlin bindings (typed Kotlin API with suspend fun + sealed class errors)

This FFI ships only to SDK consumers (XCUITest target / instrumentation test target / Expo dev-client), NEVER linked into app binary. Release app build has 0 smix-ffi bytes.

§License

Apache-2.0 OR MIT (workspace inherited). smix-ffi — UniFFI v0.29+ FFI scaffolding crate (v7.0 c2 MVP).

Wraps Rust stone API (smix-selector + smix-selector-resolver + smix-screen) into cross-language bindings via UniFFI. v7.0 c3+ 起 expand 到 ~10 runner async fn + cancellation siblings per design.md D8 + spike #4 workaround.

Generated bindings (post-build):

  • Swift via uniffi-bindgen-swiftbindings/swift/SmixFFI.swift
  • Kotlin via uniffi-bindgen --language kotlinbindings/kotlin/...

Enums§

FfiError
FFI error variants (mirror UDL [Error] enum).

Functions§

resolve_selector
Resolve a selector against an a11y tree, both passed as JSON strings.
resolve_selector_count
Count selector matches against a tree. Returns total match count (skips index modifier per Playwright “match all” semantics, mirroring resolve_selector_all behavior).
resolve_selector_labels
Resolve selector and return each match’s accessibility label. Returns a Vec<String> aligned 1:1 with the matched candidate set; empty string when the match’s .label is None.