pub struct RankStats {
pub count: usize,
pub max_len: usize,
pub total_len: usize,
}Expand description
Rank-length statistics used to decide whether Rank::rebalance is needed.
Fields§
§count: usizeNumber of ranks to be aggregated.
max_len: usizeMaximum rank length in digits, the main indicator of rank-space expansion.
total_len: usizeSum of all rank lengths (used to calculate average).
Implementations§
Source§impl RankStats
impl RankStats
Sourcepub fn collect<'a, I>(ranks: I) -> RankStatswhere
I: IntoIterator<Item = &'a Rank>,
pub fn collect<'a, I>(ranks: I) -> RankStatswhere
I: IntoIterator<Item = &'a Rank>,
Traverse the rank column and aggregate statistics.
Sourcepub fn average_len(&self) -> f64
pub fn average_len(&self) -> f64
Return the average rank length, or 0.0 when no ranks were provided.
Sourcepub fn should_rebalance(&self, max_len_threshold: usize) -> bool
pub fn should_rebalance(&self, max_len_threshold: usize) -> bool
Return whether the maximum rank length exceeds max_len_threshold.
Trait Implementations§
impl Copy for RankStats
impl Eq for RankStats
impl StructuralPartialEq for RankStats
Auto Trait Implementations§
impl Freeze for RankStats
impl RefUnwindSafe for RankStats
impl Send for RankStats
impl Sync for RankStats
impl Unpin for RankStats
impl UnsafeUnpin for RankStats
impl UnwindSafe for RankStats
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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