Function sub

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

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

§Parameters

  • op1: The minuend.
  • op2: The subtrahend.

§Returns

The difference of the operands.

§Examples

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