pub fn spawn_rebuild_worker<F>(
livereload: LiveReload,
rebuild: F,
) -> RebuildWorkerExpand description
Spawn the rebuild worker on a dedicated OS thread and return the
owned handle used to shut it down. The watcher closure should
call tx.try_send(paths) with the changed paths for every filesystem
event burst — failed sends (channel full) are intentional coalescing.
Obtain tx via RebuildWorker::sender.
The closure runs synchronously on the worker thread, so it may use
blocking I/O freely. It returns Ok(warnings) on success (a possibly-empty
list of plain, color-free advisory lines to print under the rebuild line) or
Err(RebuildError) on failure; the worker prints the error’s terminal
rendering and broadcasts its plain message to connected browsers.
Keep the returned RebuildWorker alive until the server stops, then drop
the watcher and call RebuildWorker::shutdown to wait for active writes.