Expand description
Hybrid Bridge — sync reads + async mutations communication model.
The engine’s architecture is batch-oriented and frame-driven (like Flutter). Enforcing fully synchronous communication would break the scheduler, layout computation, and “one commit per frame” design.
The hybrid bridge splits JS↔Rust communication into two paths:
┌──────────────────────────────────────────────────────┐ │ SYNC PATH (JSI-like, immediate return) │ │ JS ↔ Rust │ │ • Read-only queries: measure, focus, scroll offset │ │ • Native event → JS callback dispatch │ │ ❌ No UI mutations allowed on this path │ └──────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────┐ │ ASYNC PATH (IR / FlatBuffers, frame-batched) │ │ JS → Rust (one-way per frame) │ │ • All mutations: create, update, remove, reparent │ │ • Navigation, layout changes, mount/unmount │ │ • Processed via scheduler priority lanes │ └──────────────────────────────────────────────────────┘
Structs§
- Text
Style Input - Simplified text style for sync MeasureText calls (serde-compatible).
Enums§
- Async
Call - Asynchronous call from JS → Rust. Returns immediately, enqueues work. These are processed on the next frame via the scheduler.
- Native
Callback - A callback event dispatched synchronously from Rust → JS. These are the native events that React needs to respond to immediately.
- Sync
Call - Synchronous call from JS → Rust. Returns immediately. RULE: No mutation allowed. Read-only queries only.
- Sync
Result - Result of a synchronous call.
Traits§
- Sync
Safe - Marker trait: types that are safe for the sync path. Sync operations MUST NOT mutate the tree, layout, or native views.
Functions§
- appscale_
async_ ⚠call - Asynchronous call from native → Rust. Returns immediately, enqueues work.
- appscale_
free_ ⚠string - Free a string returned by
appscale_sync_call. - appscale_
sync_ ⚠call - Synchronous call from native → Rust. Blocks, returns JSON string.
The caller MUST free the returned string with
appscale_free_string(). - set_
engine_ ⚠ptr - Initialize the global engine pointer. Must be called once at startup.