pub struct HeartbeatWatch { /* private fields */ }Expand description
A running heartbeat-file watch. Dropping it stops and joins the thread.
The age is measured from the file’s modification time. A file that is missing (or whose modification time cannot be read) keeps aging from the last time it was seen, or from when the watch started if it was never seen, so a writer that never starts is reported too.
Implementations§
Source§impl HeartbeatWatch
impl HeartbeatWatch
Sourcepub fn spawn(
name: &str,
config: HeartbeatConfig,
on_event: impl Fn(HeartbeatEvent) + Send + 'static,
) -> Result<Self>
pub fn spawn( name: &str, config: HeartbeatConfig, on_event: impl Fn(HeartbeatEvent) + Send + 'static, ) -> Result<Self>
Starts watching config.path. on_event runs on the watch thread, so keep it short.
Trait Implementations§
Source§impl Drop for HeartbeatWatch
impl Drop for HeartbeatWatch
Auto Trait Implementations§
impl !RefUnwindSafe for HeartbeatWatch
impl !UnwindSafe for HeartbeatWatch
impl Freeze for HeartbeatWatch
impl Send for HeartbeatWatch
impl Sync for HeartbeatWatch
impl Unpin for HeartbeatWatch
impl UnsafeUnpin for HeartbeatWatch
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