pub trait Unsigned {
type Unsigned;
// Required method
fn unsigned(self) -> Self::Unsigned;
}
Expand description
Helper trait used to add unsigned()
methods to primitive signed integer
types.
The purpose of this trait is to signal the intent that the sign bit of a signed integer is intended to be discarded and the value is instead understood to be a “bag of bits” where the conversion to an unsigned number is intended to be lossless. This can be used for example when converting a signed integer into a larger width with zero-extension.