pub trait CheckedAdd: Sized + Add<Self> {
// Required method
fn checked_add(self, v: Self) -> Option<<Self as Add<Self>>::Output>;
}Expand description
Performs addition, returning None if overflow occurred.
Required Methods§
Sourcefn checked_add(self, v: Self) -> Option<<Self as Add<Self>>::Output>
fn checked_add(self, v: Self) -> Option<<Self as Add<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".