Trait WrappingNeg
trait WrappingNeg: Sized
Performs a negation that does not panic.
Required Methods
fn wrapping_neg(self: &Self) -> SelfWrapping (modular) negation. Computes
-self, wrapping around at the boundary of the type.Since unsigned types do not have negative equivalents all applications of this function will wrap (except for
-0). For values smaller than the corresponding signed type's maximum the result is the same as casting the corresponding signed value. Any larger values are equivalent toMAX + 1 - (val - MAX - 1)whereMAXis the corresponding signed type's maximum.use WrappingNeg; assert_eq!; assert_eq!; assert_eq!; // wrapped!
Implementors
impl WrappingNeg for u16impl WrappingNeg for i8impl WrappingNeg for i128impl WrappingNeg for u32impl WrappingNeg for i16impl<T: WrappingNeg> WrappingNeg for Wrapping<T>impl WrappingNeg for u64impl WrappingNeg for i32impl WrappingNeg for usizeimpl WrappingNeg for i64impl WrappingNeg for u8impl WrappingNeg for u128impl WrappingNeg for isize