pub struct PhaseEstimator { /* private fields */ }Expand description
Tracks the producer’s arrival cadence from the consumer side.
Implementations§
Source§impl PhaseEstimator
impl PhaseEstimator
pub fn new(cfg: PhaseConfig) -> Self
Sourcepub fn record(&mut self, now: Instant)
pub fn record(&mut self, now: Instant)
Record an arrival observed at now. O(1); updates the period
EWMA, the CV, the sample count, and the engaged state (with
hysteresis).
Sourcepub fn predict_next(&self) -> Option<Instant>
pub fn predict_next(&self) -> Option<Instant>
Predicted timestamp of the next arrival, or None if no
period is known yet.
Auto Trait Implementations§
impl Freeze for PhaseEstimator
impl RefUnwindSafe for PhaseEstimator
impl Send for PhaseEstimator
impl Sync for PhaseEstimator
impl Unpin for PhaseEstimator
impl UnsafeUnpin for PhaseEstimator
impl UnwindSafe for PhaseEstimator
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