pub struct RateCalculator { /* private fields */ }Expand description
The rate the far end is receiving, from acknowledged bytes over a sliding window.
§Why the controller needs this and not the target
On a decrease, AIMD backs off to a fraction of what the path is delivering, not of what the sender was aiming for. Those differ exactly when it matters: a sender aiming at 2 Mb/s over a path carrying 600 kb/s must drop to about 500 kb/s, not to 1.7 Mb/s. Backing off from the target would take several rounds to reach the same place, queueing the whole way down.
Implementations§
Source§impl RateCalculator
impl RateCalculator
Sourcepub fn rate_bits_per_second(&mut self, now: Instant) -> Option<f64>
pub fn rate_bits_per_second(&mut self, now: Instant) -> Option<f64>
The received rate in bits per second, or None when the window holds too little to say.
None rather than zero: a controller that reads an empty window as “the path is delivering
nothing” would back off to its floor on the first feedback gap.
Trait Implementations§
Source§impl Clone for RateCalculator
impl Clone for RateCalculator
Source§fn clone(&self) -> RateCalculator
fn clone(&self) -> RateCalculator
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 moreSource§impl Debug for RateCalculator
impl Debug for RateCalculator
Auto Trait Implementations§
impl Freeze for RateCalculator
impl RefUnwindSafe for RateCalculator
impl Send for RateCalculator
impl Sync for RateCalculator
impl Unpin for RateCalculator
impl UnsafeUnpin for RateCalculator
impl UnwindSafe for RateCalculator
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