pub trait StrictAdd: Sized {
type Output;
// Required method
fn strict_add(self, v: Self) -> Self::Output;
}Expand description
Performs addition that panics on overflow, even in release builds.
Required Associated Types§
Required Methods§
Sourcefn strict_add(self, v: Self) -> Self::Output
fn strict_add(self, v: Self) -> 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".