num-traits icon indicating copy to clipboard operation
num-traits copied to clipboard

Add `ConstLowerBounded`/`ConstUpperBounded`/`ConstBounded` traits, impls, and tests

Open linclelinkpart5 opened this issue 7 months ago • 0 comments

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.

linclelinkpart5 avatar Apr 28 '25 05:04 linclelinkpart5