pub struct LoadBalance<K> { /* private fields */ }Expand description
Result of load balancing - tracks loads per item and computes unfairness.
Unfairness is the square root of sum of squared deviations from mean. Lower values indicate fairer distribution. Zero means perfectly balanced.
Implementations§
Source§impl<K> LoadBalance<K>
impl<K> LoadBalance<K>
Trait Implementations§
Source§impl<K: Clone + Eq + Hash + Send + Sync> Accumulator<(K, i64), LoadBalance<K>> for LoadBalanceAccumulator<K>
impl<K: Clone + Eq + Hash + Send + Sync> Accumulator<(K, i64), LoadBalance<K>> for LoadBalanceAccumulator<K>
Source§type Retraction = (K, i64)
type Retraction = (K, i64)
Retained handle needed to undo one accumulated value.
Source§fn accumulate(&mut self, value: (K, i64)) -> Self::Retraction
fn accumulate(&mut self, value: (K, i64)) -> Self::Retraction
Adds an owned value to the accumulator and returns its retraction handle.
Source§fn retract(&mut self, value: Self::Retraction)
fn retract(&mut self, value: Self::Retraction)
Removes a value previously represented by the retraction handle.
Source§fn with_result<T>(&self, f: impl FnOnce(&LoadBalance<K>) -> T) -> T
fn with_result<T>(&self, f: impl FnOnce(&LoadBalance<K>) -> T) -> T
Exposes the current result without forcing owned result materialization.
Source§impl<K: Clone> Clone for LoadBalance<K>
impl<K: Clone> Clone for LoadBalance<K>
Auto Trait Implementations§
impl<K> Freeze for LoadBalance<K>
impl<K> RefUnwindSafe for LoadBalance<K>
impl<K> Send for LoadBalance<K>
impl<K> Sync for LoadBalance<K>
impl<K> Unpin for LoadBalance<K>
impl<K> UnsafeUnpin for LoadBalance<K>
impl<K> UnwindSafe for LoadBalance<K>
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