0010: egui-pop wraps the application’s kernel through a host
Date: 2026-10-12. Status: accepted.
Context
Until now egui-pop ran commands itself: handlers were closures run on the interface thread, settings lived in its own store. An application with a kernel of its own cannot work that way: its engine may run in another process, a command may be long, asynchronous or remote, and its bus already orders events (sequence, source, cause) in a journal its tests read. egui-pop exists to help build such applications and keep their code clean, so it must wrap the kernel, not be it.
Decision
egui-pop keeps the interface’s part: command declarations (name, keys,
when, menus, arguments) feeding the menus, the palette, the keymap and
the traces; focus, overlays, layout, theme; interface settings.
The application’s part goes through egui_pop_api::host::Host, which
the application implements and gives to AppBuilder::host:
dispatch(Dispatch) -> Reply: the result now (Done) or later (Later(Pending), given from any thread through itsResolver). A frame never waits; the command shows as running (its menu items greyed) until its result arrives, then its failure is shown;- an event journal:
publish(source, cause, name, data) -> Seqandsince(seq). egui-pop publishescommand.dispatched, thencommand.doneorcommand.failedcaused by it; the debug bridge’sjournalcollector reads it; store(): the value store holding settings and values;set_waker(Waker): the host wakes the interface from any thread.
LocalHost is the default and keeps the earlier behaviour: commands
declared with an in-process handler (Ctx::command) run on the
interface thread, the journal is in memory. Commands the host runs are
declared without a handler (Ctx::declare). A host may run in-process
handlers too (Dispatch::run_local).
Consequences
App::runreturns aReply;Reply::now()gives a result that is already there.- Simple applications, the gallery and the template write nothing more.
- An application with its own kernel adapts its bus and its command
runner to
Host; egui-pop’s command and settings API must not assume egui-pop executes commands. - Not settled yet: settings persistence still goes through egui-pop’s
Persistdocuments; a host storing settings elsewhere supplies a store and saves it itself.