plushie/gui
Start a plushie GUI application.
This is the primary entry point for desktop apps. It resolves the plushie binary, starts the runtime (which spawns the Rust renderer as a child port), and blocks the calling process indefinitely. The runtime manages its own lifecycle in a spawned process.
Users call gui.run from their own main function:
import plushie/gui
pub fn main() {
gui.run(my_app.app(), gui.default_opts())
}
Set dev: True in GuiOpts to enable live reload – the dev
server watches src/ for changes, recompiles, hot-reloads BEAM
modules, and triggers a re-render without losing app state.
Types
Options for starting a GUI application.
pub type GuiOpts {
GuiOpts(
json: Bool,
daemon: Bool,
dev: Bool,
debounce: Int,
binary_path: Result(String, Nil),
)
}
Constructors
-
GuiOpts( json: Bool, daemon: Bool, dev: Bool, debounce: Int, binary_path: Result(String, Nil), )Arguments
- json
-
Use JSON wire format instead of MessagePack. Default: False.
- daemon
-
Keep running after all windows close. Default: False.
- dev
-
Enable dev-mode live reload. Default: False.
- debounce
-
File watch debounce interval in milliseconds. Default: 100.
- binary_path
-
Explicit path to the plushie binary. Error(Nil) = auto-resolve.
Values
pub fn run(
app: app.App(model, event.Event),
opts: GuiOpts,
) -> Nil
Start a plushie GUI application, blocking until it exits.
Resolves the binary, starts the runtime with the given options, and blocks the calling process indefinitely. The runtime runs in a spawned process and handles its own lifecycle.