pub trait WrappingAbs: Sized + Neg {
// Required method
fn wrapping_abs(self) -> <Self as Neg>::Output;
}Expand description
Computes the absolute value, wrapping around on overflow.
Required Methods§
Sourcefn wrapping_abs(self) -> <Self as Neg>::Output
fn wrapping_abs(self) -> <Self as Neg>::Output
Wrapping (modular) absolute value. Computes self.abs(), wrapping
around at the boundary of the type. The only wrapping case is
MIN.wrapping_abs() == MIN.
use const_num_traits::WrappingAbs;
assert_eq!(WrappingAbs::wrapping_abs(-100i8), 100);
assert_eq!(WrappingAbs::wrapping_abs(i8::MIN), i8::MIN); // wrapped!Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".