num-traits
num-traits copied to clipboard
Add unconditionally implemented (potentially) open-ended bounds
I have a use-case for a function supporting both big integers and primitive integers. It would be useful to be able to get the minimum and maximum value as an Option<T> at runtime, without having to use a generic info.
| Type | Bounds |
|---|---|
BigInt |
.. |
BigUInt |
0.. |
T: Bounded |
T::min_value()..=T::max_value() |
This could be implemented as:
trait FiniteRange {
fn min_value() -> Option<Self>;
fn max_value() -> Option<Self>;
}