Trait CheckedNeg
trait CheckedNeg: Sized
Performs negation that returns None if the result can't be represented.
Required Methods
fn checked_neg(self: &Self) -> Option<Self>Negates a number, returning
Nonefor results that can't be represented, like signedMINvalues that can't be positive, or non-zero unsigned values that can't be negative.Examples
use CheckedNeg; use MIN; assert_eq!; assert_eq!; assert_eq!; assert_eq!; assert_eq!;
Implementors
impl CheckedNeg for u32impl CheckedNeg for i16impl CheckedNeg for u64impl CheckedNeg for i32impl CheckedNeg for usizeimpl CheckedNeg for i64impl CheckedNeg for u8impl CheckedNeg for u128impl CheckedNeg for isizeimpl CheckedNeg for u16impl CheckedNeg for i8impl CheckedNeg for i128