pub struct LoadBalancePlan {
pub ranges: Vec<Range<usize>>,
pub weights: Vec<f64>,
}Expand description
Result of load balancing: a set of ranges assigned to workers.
Fields§
§ranges: Vec<Range<usize>>Ranges for each worker.
weights: Vec<f64>Total weight assigned to each worker (for Weighted strategy).
Implementations§
Source§impl LoadBalancePlan
impl LoadBalancePlan
Sourcepub fn num_workers(&self) -> usize
pub fn num_workers(&self) -> usize
Number of workers in this plan.
Sourcepub fn max_weight(&self) -> f64
pub fn max_weight(&self) -> f64
Maximum weight across workers (a measure of imbalance).
Sourcepub fn imbalance_ratio(&self) -> f64
pub fn imbalance_ratio(&self) -> f64
Imbalance ratio: max_weight / avg_weight. 1.0 is perfect balance.
Auto Trait Implementations§
impl Freeze for LoadBalancePlan
impl RefUnwindSafe for LoadBalancePlan
impl Send for LoadBalancePlan
impl Sync for LoadBalancePlan
impl Unpin for LoadBalancePlan
impl UnsafeUnpin for LoadBalancePlan
impl UnwindSafe for LoadBalancePlan
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more