refactor election score (#10834)

* refactor election score

* Test for ord

* remove reference

* vec -> slice

* change iter to iter_by_significance

* improve doc

* fix typo

* add explanation about [u128; 3]

* consolidate threshold and epsilon

* random fixes

* rename

* remove Into

* make iter_by_sig private

* remove vec

* Fix tests
This commit is contained in:
Kian Paimani
2022-02-16 10:40:16 +00:00
committed by GitHub
parent 9d8e5639d5
commit 6b7eb2e2d7
9 changed files with 281 additions and 124 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ use traits::{BaseArithmetic, One, SaturatedConversion, Unsigned, Zero};
/// - `Ordering::Equal` otherwise.
pub trait ThresholdOrd<T> {
/// Compare if `self` is `threshold` greater or less than `other`.
fn tcmp(&self, other: &T, epsilon: T) -> Ordering;
fn tcmp(&self, other: &T, threshold: T) -> Ordering;
}
impl<T> ThresholdOrd<T> for T