The std::num::wrapping module provides a trait, OverflowingOps, that permits overflowing arithmetic on primitive types and tells whether an overflow occurred.
Other methods, like saturating_add and wrapping_add, are included directly as inherent methods on these types.
It's not clear whether the overflowing_foo methods are useful, and if so, whether there's any reason for them to live on a trait. Ideally, if we kept them, they'd move onto the primitive types, and the wrapping module would be removed.
The
std::num::wrappingmodule provides a trait,OverflowingOps, that permits overflowing arithmetic on primitive types and tells whether an overflow occurred.Other methods, like
saturating_addandwrapping_add, are included directly as inherent methods on these types.It's not clear whether the
overflowing_foomethods are useful, and if so, whether there's any reason for them to live on a trait. Ideally, if we kept them, they'd move onto the primitive types, and thewrappingmodule would be removed.