pub trait CheckedAdd: Sized {
type Output;
// Required method
fn checked_add(self, v: Self) -> Option<Self::Output>;
}Expand description
Performs addition, returning None if overflow occurred.
Required Associated Types§
Required Methods§
Sourcefn checked_add(self, v: Self) -> Option<Self::Output>
fn checked_add(self, v: Self) -> Option<Self::Output>
Adds two numbers, checking for overflow. If overflow happens, None is
returned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".