num-traits
num-traits copied to clipboard
Add `ConstLowerBounded`/`ConstUpperBounded`/`ConstBounded` traits, impls, and tests
Adds functionality as requested in #252.
This is done by adding ConstLowerBounded and ConstUpperBounded traits, with associated costs of const MIN: Self and const MAX: Self, respectively. In addition, I also included ConstBounded as a supertrait, and impl'd it for all types that implement ConstLowerBounded + ConstUpperBounded:
pub trait ConstBounded: ConstLowerBounded + ConstUpperBounded {}
impl<T: ConstLowerBounded + ConstUpperBounded> ConstBounded for T {}
These traits have been implemented for all primitive types that the existing Bounded traits have been impl'd for.