Expand description
Generic rebuild-worker driver for dev servers.
Spawns a background OS thread that owns the rebuild loop:
- Block waiting for a tick.
- Drain any extra ticks queued before the thread woke up — they coalesce into a single rebuild.
- Run the user-supplied rebuild closure.
- Drain any ticks that arrived during the rebuild — if any did, re-tick ourselves so the next iteration runs without waiting.
- Report success / error via
RebuildReporterand broadcast the corresponding live-reload event.
The closure is the only thing that varies between consumers
(webui-cli builds and renders an app, webui-press rebuilds a docs
site). It returns Result<(), String> so the worker can
uniformly format the error and broadcast it to connected browsers.
Functions§
- spawn_
rebuild_ worker - Spawn the rebuild worker on a dedicated OS thread and return the
sender used to enqueue rebuild ticks. The watcher closure should
call
tx.try_send(())for every filesystem event burst — failed sends (channel full) are intentional coalescing.
Type Aliases§
- Tick
Sender - Tick sender given to the watcher closure. Cheap to clone.