pub struct LatencyEstimator { /* private fields */ }Expand description
Smoothed endpoint RTT estimates.
The estimator intentionally receives dispatch-to-completion measurements; callers should not feed local queue or pacing delay into it.
Implementations§
Source§impl LatencyEstimator
impl LatencyEstimator
Sourcepub fn new(config: LatencyEstimatorConfig) -> Self
pub fn new(config: LatencyEstimatorConfig) -> Self
Creates a latency estimator with the configured initial RTT.
§Panics
Panics when the minimum RTT, initial RTT, EWMA weights, or baseline window is invalid.
Sourcepub fn observe(&mut self, sample: Duration)
pub fn observe(&mut self, sample: Duration)
Observes a dispatch-to-completion RTT using the current clock time.
Use Self::observe_at when deterministic timing is required.
Sourcepub fn observe_at(&mut self, sample: Duration, now: Instant)
pub fn observe_at(&mut self, sample: Duration, now: Instant)
Observes a dispatch-to-completion RTT at an explicit time.
Samples below LatencyEstimatorConfig::min_rtt are clamped. The
explicit time controls rotation of the rolling minimum-RTT window.
Sourcepub fn expected_rtt(&self) -> Duration
pub fn expected_rtt(&self) -> Duration
Returns the long-term RTT used for Little’s Law rate derivation.
Trait Implementations§
Source§impl Clone for LatencyEstimator
impl Clone for LatencyEstimator
Source§fn clone(&self) -> LatencyEstimator
fn clone(&self) -> LatencyEstimator
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 Freeze for LatencyEstimator
impl RefUnwindSafe for LatencyEstimator
impl Send for LatencyEstimator
impl Sync for LatencyEstimator
impl Unpin for LatencyEstimator
impl UnsafeUnpin for LatencyEstimator
impl UnwindSafe for LatencyEstimator
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