Function add

Source
pub fn add(op1: i32, op2: i32) -> i32
Expand description

Computes the sum of the two operands, saturating on overflow. This serves as the definition of the addition operation in the dice expression language.

§Parameters

  • op1: The augend.
  • op2: The addend.

§Returns

The sum of the operands.

§Examples

assert_eq!(add(1, 2), 3);
assert_eq!(add(i32::MAX, 1), i32::MAX);
assert_eq!(add(i32::MIN, -1), i32::MIN);