Skip to main content

run_dev_loop

Function run_dev_loop 

Source
pub fn run_dev_loop<F: FnMut(&[PathBuf])>(
    watcher: &EventWatcher,
    graph: &DepGraph,
    broadcaster: &HmrBroadcaster,
    output_dir: &Path,
    rebuild: F,
) -> usize
Expand description

Pumps debounced batches off watcher and broadcasts each frame.

The closure rebuild is called once per batch with the invalidated output list so callers can plug in the incremental pipeline.

Returns the number of batches processed before the watcher closed, which is useful for tests that inject a finite event stream.

§Examples

ⓘ
// Requires a real EventWatcher + HmrBroadcaster bound to a port,
// which a doctest sandbox can't safely set up. See the `dev` binary
// (`src/bin/dev.rs`) for a runnable wiring.
use ssg::dev_server::run_dev_loop;