Skip to main content

Module runtime

Module runtime 

Source
Expand description

§Runtime

The Bubba runtime — bridges Rust UI logic to Android native views, exactly like React Native’s bridge between JS and UIManager.

§Architecture

Rust view! macro  →  Element tree  →  JSON
                                        ↓
                                   JNI bridge
                                        ↓
                                 ViewInflater.java
                                        ↓
                           Real Android Views (TextView, Button…)
                                        ↓
                              User taps button
                                        ↓
                          nativeOnEvent(id, "click", "")
                                        ↓
                         Rust EventDispatcher fires handler
                                        ↓
                         navigate() → new Element tree → JSON
                                        ↓
                              Java re-inflates Views

Structs§

Runtime
The Bubba runtime. One per process.

Constants§

BUBBA_VERSION
Bubba runtime version.

Functions§

alert
Show a native alert dialog.
did_navigate
Returns true if a navigation event occurred since the last render. Called by Java after every nativeOnEvent() to know if it should re-render.
dispatch_event
Dispatch an event from Java into the matching Rust EventHandler.
log_msg
Log a debug message.
on_navigate
Called internally when navigate() fires so Java knows to re-render.
render_current_to_json
Build the current screen’s element tree, register its handlers, and return the JSON string to send to Java’s ViewInflater.
set_global_runtime
Register the runtime for use by spawn().
spawn
Spawn a future on the async executor.