Performs addition that returns None instead of wrapping around on
overflow.
Signature
pub trait CheckedAdd
Examples
use core::num::traits::CheckedAdd;let result = 1_u8.checked_add(2);assert!(result == Some(3));let result = 255_u8.checked_add(1);assert!(result == None); // Overflow
Trait functions
checked_add
Adds two numbers, checking for overflow. If overflow happens, None is
returned.