Skip to main content

Module host_warning

Module host_warning 

Source
Expand description

v3.5.0 (FE-06) — the host-facing warning codes every frontend shares.

A HostWarning is something a host (the desktop, the browser, the Android and iOS apps, a downstream embedder) should tell the player, as a stable machine-readable code rather than a pre-composed sentence, so each host can render it in the player’s language. HostWarning::message is the canonical English text for a host that does not localise.

The enum was introduced in the mobile bridge (v2.0.3, rustynes-mobile), which exports it to Kotlin and Swift. Until v3.5.0 it lived there, and the desktop and browser frontends, which cannot depend on the UniFFI bridge, were said to stay “in parity” by carrying identical English literals of their own. They carried none: neither warning has a desktop or browser producer (see below), so there was nothing to keep in parity, only a second place a future warning’s text would have had to be copied to. The definition now lives here, at the surface every host already depends on; the bridge re-exports this type to Kotlin / Swift unchanged (a UniFFI remote enum; the generated bindings differ only in doc comments), and a desktop or browser warning added later takes its code and its English from this one place.

Which hosts produce which code today:

codemobiledesktop / browser
HostWarning::PreTimebaseMovieno longer (v2.9.8: older movies are refused)never
HostWarning::RecoveredFromInternalErrorthe bridge’s poisoned-lock recoverynever: release builds abort on panic (panic = "abort"), so there is no lock left to recover

Grow it by adding variants (each with its own message arm); never repurpose one, so a host’s per-code localisation table cannot silently change meaning under it. The bridge’s remote declaration must list the same variants, which the compiler enforces.

Enums§

HostWarning
A machine-readable code for a host-facing warning. See the module docs.