Trait tallyman::Numeric

source ·
pub trait Numeric {
    fn floor(self) -> Self;
    fn fraction() -> bool;
}
Expand description

A trait for numeric types used to count votes. This type should be automatically implemented for all numeric types you wish to use. It is used to provide trait specialization so differnetial logic can applied to integer or fractional (float) based vote counting.

Required Methods§

Get the floor for this numeric type. For non-fractional types, this just returns self.

Does this numeric type support fractional values? Integer-based types will return false. Float, or num_rational::Ratio based types should return true.

Implementors§