Skip to main content

start_watching

Function start_watching 

Source
pub fn start_watching(dir: Arc<PathBuf>, broadcaster: Broadcaster)
Expand description

Start watching a directory for file changes.

Spawns a background task that periodically polls the directory tree for modifications using mtime. When changes are detected, broadcasts them to all active subscribers via the given broadcaster.

The poll interval is bounded to prevent busy-waiting (per architecture principle A2). Polls every 500ms — a balance between responsiveness and system load.

§Panics

Panics if the async task cannot be spawned (e.g., no runtime available).