The primitive unsigned integer types only implement Smaller::from(bigger) and Bigger::try_from(smaller). They do not implement Bigger::from(smaller), since that could cause truncation. Instead, as is used to convert without overflow checks and with truncation.
These Uint types should work the same way, to avoid accidentally truncating values. Instead, there should be the following options:
- from(...) - only if the conversion is guaranteed to work
- try_from(...).unwrap() - similar behavior to new() currently, panic on overflow
- from_truncated() - or something like that, for an analogous version of primitive
as
(Furthermore, it does not seem to be documented whether the Uint::From implementation truncates or panics on overflow.)