pub struct ProgressWatchdog<T> { /* private fields */ }Expand description
Detects a decode loop that stopped advancing.
Takes the current time from the caller rather than reading the clock, so a test proves the stall behaviour in microseconds instead of sleeping through the timeout.
Implementations§
Source§impl<T: Copy + Sub<T, Output = Duration>> ProgressWatchdog<T>
impl<T: Copy + Sub<T, Output = Duration>> ProgressWatchdog<T>
pub const fn new(timeout: Duration, started: T) -> Self
Sourcepub fn record_frame(&mut self, now: T)
pub fn record_frame(&mut self, now: T)
Record a frame boundary, resetting the stall timer.
pub const fn frames_emitted(&self) -> u64
Sourcepub fn check(&self, now: T) -> Result<(), HealthViolation>
pub fn check(&self, now: T) -> Result<(), HealthViolation>
Fail if no frame has been recorded within the timeout.
Trait Implementations§
Source§impl<T: Clone> Clone for ProgressWatchdog<T>
impl<T: Clone> Clone for ProgressWatchdog<T>
Source§fn clone(&self) -> ProgressWatchdog<T>
fn clone(&self) -> ProgressWatchdog<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for ProgressWatchdog<T>where
T: Freeze,
impl<T> RefUnwindSafe for ProgressWatchdog<T>where
T: RefUnwindSafe,
impl<T> Send for ProgressWatchdog<T>where
T: Send,
impl<T> Sync for ProgressWatchdog<T>where
T: Sync,
impl<T> Unpin for ProgressWatchdog<T>where
T: Unpin,
impl<T> UnsafeUnpin for ProgressWatchdog<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ProgressWatchdog<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).