pub struct Coalescer { /* private fields */ }Expand description
Accumulates changed paths and releases them once the window has elapsed.
Deliberately holds no clock of its own: the caller supplies now, which is what makes
the policy testable without sleeping.
Implementations§
Source§impl Coalescer
impl Coalescer
pub fn new(window: Duration) -> Self
Sourcepub fn push(&mut self, path: PathBuf, now: Instant)
pub fn push(&mut self, path: PathBuf, now: Instant)
Note a changed path. The window starts on the first path of a batch.
pub fn is_empty(&self) -> bool
Sourcepub fn time_remaining(&self, now: Instant) -> Option<Duration>
pub fn time_remaining(&self, now: Instant) -> Option<Duration>
How long until the current batch is ready, if one is open.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Coalescer
impl RefUnwindSafe for Coalescer
impl Send for Coalescer
impl Sync for Coalescer
impl Unpin for Coalescer
impl UnsafeUnpin for Coalescer
impl UnwindSafe for Coalescer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more