Expand description
App-agnostic frontend core: the Elm-style loop update(model, msg) -> effects.
The core is pure: it reads no clock, network, disk or randomness. Effects are data; the shell
(browser, iOS, Android, a test harness) runs them and answers with resolve. Shells only draw
view models and run effects. See the README for the pattern and a minimal app.
Structs§
- Action
Spec - A legal action with a hand-rolled JSON schema (an object whose fields are all required).
- Clock
Offset - Server clock offset from the best (lowest round trip) sample: the server’s time is assumed to be read at the call midpoint.
- Ctx
- What
updatemay do besides mutating the model: mark views dirty and request effects. - Effect
Req - An effect with its request id, serialized flat:
{"id":3,"Http":{...}}. - Http
Reply - The
okpayload of an answeredEffect::Http.sentandrecvare local wall-clock ms. - Pending
- Effect ids still waiting for their answer, each with what the app was doing when it asked.
Keeps
resolveamatchon a state-machine enum instead of scattered flags. - Pointer
- One pointer sample on the typed fast path.
xandyare in units the app chooses (cells, pixels, a 0..1 canvas); the engine never interprets them. - Retry
Policy - Retry with exponential backoff and jitter.
- Runtime
- Drives an
Appwith the protocol. Construct withRuntime::new.
Enums§
- Effect
- A capability the shell implements. The built-in set is small and universal; anything else
(haptics, sound, share sheets, push registration, review prompts) is the app’s own effect type
X, carried byEffect::Appand serialized flat next to the built-ins, so a shell matches on one key:{"id":3,"Http":{...}}or{"id":4,"Vibrate":{"ms":20}}. - Field
Type - JSON-schema type of one action field.
- Navigate
Op - How a
Effect::Navigatechanges the history. - NoEffect
- The app-defined effect type of an app that needs none.
Constants§
- BRIDGE_
PROTOCOL - The bridge message format (shell to core): the boot message carries
"v"and every response echoes it. Not an app’s API contract: apps version that themselves. - BUILT_
IN_ EFFECT_ NAMES - The variant names of the built-in effects. An app effect serialized under one of these reads
back as the built-in (the untagged
Effect::Appis tried last), so app effect names must avoid them.Runtimechecks this in debug builds and tests.
Traits§
- App
- The app: a model plus pure transitions. All time comes from
ctx.at(). - Bridge
- The surface every bridge (
UniFFI,wasm-bindgen, a test harness) wraps. Bytes in, bytes out.
Functions§
- builtin_
collision - The built-in name an app effect collides with, if any.