pub trait StrictAdd: Sized + Add<Self> {
// Required method
fn strict_add(self, v: Self) -> <Self as Add<Self>>::Output;
}Expand description
Performs addition that panics on overflow, even in release builds.
Required Methods§
Sourcefn strict_add(self, v: Self) -> <Self as Add<Self>>::Output
fn strict_add(self, v: Self) -> <Self as Add<Self>>::Output
Strict addition. Computes self + v, panicking on overflow regardless
of whether overflow checks are enabled.
use const_num_traits::StrictAdd;
assert_eq!(StrictAdd::strict_add(5u8, 250), 255);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".