Skip to main content

debounce_paths

Function debounce_paths 

Source
pub fn debounce_paths(
    events: &[(PathBuf, Instant)],
    window: Duration,
) -> Vec<ChangeBatch>
Expand description

Pure helper: collapse a stream of (path, instant) events into a list of debounced batches. Used by tests so the debouncer logic can be verified without spawning threads.

ยงExamples

use std::path::PathBuf;
use std::time::{Duration, Instant};
use ssg::event_watch::debounce_paths;
let t0 = Instant::now();
let events = vec![
    (PathBuf::from("a.md"), t0),
    (PathBuf::from("a.md"), t0 + Duration::from_millis(20)),
];
let out = debounce_paths(&events, Duration::from_millis(100));
assert_eq!(out.len(), 1);
assert_eq!(out[0].len(), 1);