Expand description
Raw extern "C" declarations matching bridge/include/whisker_bridge.h.
Everything here is unsafe to call. Safe wrappers (and the host shim
whisker_app_main / whisker_tick exports) live in whisker-driver. Users
never depend on this crate directly.
Structs§
- Whisker
Bytes Ref struct { const uint8_t* ptr; size_t len; }member.- Whisker
Element - Whisker
Engine - Whisker
KeyValue Raw struct WhiskerKeyValueRec— string-keyed entry of themapvariant.- Whisker
String Ref struct { const char* ptr; size_t len; }member of the C union (also used as thekeyfield ofWhiskerKeyValueRaw).- Whisker
Value Array struct WhiskerValueArrayRec— pointer tocountWhiskerValueRawitems.- Whisker
Value Map struct WhiskerValueMapRec— pointer tocountWhiskerKeyValueRawentries.- Whisker
Value Raw - Raw FFI form of
WhiskerValue— byte-for-byte compatible with the Cstruct WhiskerValueRec. Total size = 24 bytes (1 discriminant + 7 padding + 16 union = 24).
Enums§
- Whisker
Element Tag - Whisker
Value Type - Discriminant for
WhiskerValueRaw::type_. Must stay in lock step withenum WhiskerValueTypeinwhisker_bridge.h.
Constants§
- LYNX_
LIST_ INVALID_ INDEX - Mirror of
LYNX_LIST_INVALID_INDEX(the C macro inlynx_capi.h) — returned byLynxListComponentAtIndexFnto signal “no element could be produced for this index”. Matches Lynx’slynx::tasm::list::kInvalidIndex; 0 is a realimpl_idand would be silently consumed.
Functions§
- whisker_
bridge_ ⚠append_ child - whisker_
bridge_ ⚠create_ element - whisker_
bridge_ ⚠create_ element_ by_ name - whisker_
bridge_ ⚠debug_ log_ i32 - whisker_
bridge_ ⚠dispatch - whisker_
bridge_ ⚠element_ animate - Element-level animation dispatch —
element.animate(...)shape. - whisker_
bridge_ ⚠element_ sign - The Lynx element sign for
element— same id the reporter reports as the event target, used as the key for the driver’s tree + listener maps. Returns 0 for a null element. - whisker_
bridge_ ⚠engine_ attach - whisker_
bridge_ ⚠engine_ release - whisker_
bridge_ ⚠flush - whisker_
bridge_ ⚠invoke_ element_ method - Invoke a Lynx UI method on a mounted element. Synchronous —
dispatches through Lynx’s
LynxUIMethodProcessor(iOS) /LynxUIMethodsExecutor(Android), which in turn calls the@WhiskerUIMethod-emitted forwarder on the element’sWhiskerUI<View>subclass. - whisker_
bridge_ ⚠invoke_ element_ method_ async - Async, result-returning element-method dispatch
(
boundingClientRect/takeScreenshot). Returns immediately;callback(user_data, &result)fires once the method completes (typically on the UI thread). On precondition failure / an unsupported platform the bridge invokescallbacksynchronously with aWHISKER_VALUE_ERRORand returnsfalse. - whisker_
bridge_ ⚠invoke_ element_ method_ async_ with_ params - The unified element-method dispatch:
params(a singleWHISKER_VALUE_MAP) is passed through as the method’s params object directly, and the result arrives viacallback. The one entryElementRef::invoke/invoke_typedbuild on — both fire-and-forget actions (callback ignored) and result methods. - whisker_
bridge_ ⚠invoke_ element_ method_ with_ params - Fire-and-forget dispatch of a built-in Lynx UI method whose
arguments are named fields of the params object (
scrollTo,scrollBy,autoScroll,scrollIntoView,requestUIInfo, …) rather than the{"args": […]}wrapperwhisker_bridge_invoke_element_methodbuilds.paramsis a singleWHISKER_VALUE_MAP; it (and any nested maps / arrays) is passed through as the params object directly. ReturnsWHISKER_VALUE_NULLonce dispatch is scheduled (caller still passes it towhisker_bridge_value_release). - whisker_
bridge_ ⚠invoke_ module - Invoke a registered Whisker platform module’s method,
synchronously. See
whisker_bridge.hfor ownership rules around the returnedWhiskerValueRaw. - whisker_
bridge_ ⚠invoke_ module_ async - Async variant. Caller-supplied
callbackfires once the method completes.user_datais opaque — caller owns lifetime / dropping. - whisker_
bridge_ ⚠list_ set_ item_ count - whisker_
bridge_ ⚠list_ set_ native_ item_ provider - whisker_
bridge_ ⚠log_ info - Write
msgtoadb logcat(Android only — no-op on iOS; debug print path that survives Android’s stderr-is-dropped policy).tag == NULLdefaults to “WhiskerRust”. - whisker_
bridge_ ⚠module_ add_ event_ listener - Register
callbackagainst(module_name, event_name). Returns a positive listener id on success, or <= 0 on a precondition failure. The Rust wrapper hands the caller aModuleSubscriptionthat callswhisker_bridge_module_remove_event_listeneron drop. - whisker_
bridge_ ⚠module_ register_ observer_ hooks - Register OnStart / OnStopObserving hooks for
module_name. The bridge callsstarted(event)on the 0→1 listener-count transition andstopped(event)on 1→0, so the native module can spin up / tear down an expensive source (e.g. anOnBackInvokedCallbackregistration) only while needed. - whisker_
bridge_ ⚠module_ remove_ event_ listener - Remove a previously-registered listener. No-op if
listener_idis unknown. The bridge does not free the caller’suser_data. - whisker_
bridge_ ⚠module_ send_ event - Dispatch
payloadto every listener registered against(module_name, event_name). Called from the native module side (sendEventon Swift / Kotlin).payloadmay be NULL for an unparameterised ping. - whisker_
bridge_ ⚠register_ event_ dispatcher - Register the Rust event dispatcher (the reporter hook forwards
to it). Called once by the driver at bootstrap. See
WhiskerEventDispatcher. - whisker_
bridge_ ⚠register_ module_ dispatch - Register a dispatch function for
module_name. Called by the platform-side generated code at app launch (Swift Macro emits a@_cdeclfn + registration call; KSP emits a JNI wrapper that does the equivalent). Phase 7-Φ.F. - whisker_
bridge_ ⚠release_ element - whisker_
bridge_ ⚠remove_ child - whisker_
bridge_ ⚠set_ attribute - whisker_
bridge_ ⚠set_ attribute_ bool - whisker_
bridge_ ⚠set_ attribute_ double - whisker_
bridge_ ⚠set_ attribute_ int - whisker_
bridge_ ⚠set_ event_ listener - whisker_
bridge_ ⚠set_ event_ listener_ with_ value - whisker_
bridge_ ⚠set_ inline_ styles - whisker_
bridge_ ⚠set_ native_ event_ handler - Register a bubble-phase event handler for
event_nameonelement, populating its Lynx event set so the UI component emits the event. The driver calls this for non-gesture (component) events; touch/gesture events don’t need it. - whisker_
bridge_ ⚠set_ root - whisker_
bridge_ ⚠value_ release - Free any heap allocations the bridge attached to
value— caller ofwhisker_bridge_invoke_moduleMUST eventually call this on the returned value (no-op for scalars).
Type Aliases§
- Lynx
List Component AtIndex Fn - Called by Lynx’s list machinery when it needs the element for
index. Returns the FiberElement’simpl_id(sign) orLYNX_LIST_INVALID_INDEXon failure.reuse_notificationis 1 if the embedder may reuse an existing element for this index. - Lynx
List Enqueue Component Fn - Called when the element at
signleaves the viewport. The provider may pool or release it. - Lynx
User Data Free Fn - Free-callback for the
user_datacookie. Invoked by the bridge when the list element is destroyed (or the provider is replaced) so a RustBox<dyn FnMut>packed intouser_datacan be dropped. - Whisker
Event Callback - Whisker
Event Dispatcher - The Rust event dispatcher the bridge calls when its reporter hook
fires. Receives the hit-tested target’s element sign, the event
name (NUL-terminated), and the event body (
WhiskerValueRawtree, never NULL). Returns whether the event was consumed (so the reporter can tell Lynx to skip its native chain). Seewhisker_bridge_register_event_dispatcher. - Whisker
Event Value Callback - Value-payload event callback.
payloadis aWhiskerValueRawtree (never NULL — the bridge normalises a missing body to aWHISKER_VALUE_NULLvalue), owned by the bridge and only valid for the duration of the call (copy out viafrom_raw). Seewhisker_bridge_set_event_listener_with_value. - Whisker
Module Callback - Callback type for
whisker_bridge_invoke_module_async. Theresultpointer is borrowed for the duration of the call only — the bridge frees the underlying allocations once the callback returns, so closures that need to retain the value must copy into Rust-owned storage via thewhisker-runtimewrapper. - Whisker
Module Dispatch Fn - Per-module dispatch function — the platform-side Swift Macro or
KSP processor emits one of these per
@WhiskerModule-annotated class. The bridge stores(module_name → dispatch_fn)in a lookup table;whisker_bridge_invoke_modulethen routes calls through the registered function directly (Phase 7-Φ.F). - Whisker
Module Event Callback - Callback type for module event subscriptions. Fired by the bridge
when a registered
(module, event)pair receives awhisker_bridge_module_send_eventcall.payloadis borrowed — the bridge frees its allocations once the callback returns. - Whisker
Module Observer Hook - Callback type for
OnStartObserving/OnStopObservinghooks. The bridge fires these on the 0↔1 listener-count transition for a(module, event)pair. Bothmodule_nameandevent_nameare borrowed (NUL-terminated UTF-8) — copy if you need to retain them past the call.module_namelets a shared platform-side trampoline index its own per-module table. - Whisker
Tasm Callback
Unions§
- Whisker
Value Union #[repr(C)] unionmirroring the inner anonymous union ofWhiskerValueRec. Field access is unsafe — discriminate on the outer struct’stype_before reading.