Skip to main content

spawn_watcher

Function spawn_watcher 

Source
pub fn spawn_watcher(
    roots: Vec<PathBuf>,
    debounce: Duration,
    tx: Sender<Change>,
) -> Result<RecommendedWatcher>
Expand description

Spawn a recursive watcher rooted at each path in roots. Debounced Change batches arrive on tx. The returned RecommendedWatcher keeps the OS watches alive — drop it to stop watching.

Roots that fail to attach (don’t exist, or notify rejects them) log a warning and are skipped; the watcher still returns as long as at least one root attached. Sub-crates without a src/ are the common case — cargo metadata lists every workspace member, not every member ships a src/ (proc-macro-only crates, virtual manifest stubs, …).