Function chain_lib::calculator::try_mul

source ·
pub fn try_mul(left: u128, right: u128) -> Option<u128>
Expand description

The function try_mul in Rust attempts to multiply two u128 numbers and returns the result as an Option<u128>, ensuring no overflow occurs.

Arguments:

  • left: The left parameter is a 128-bit unsigned integer.
  • right: The right parameter is a 128-bit unsigned integer value.

Returns:

The try_mul function returns an Option<u128>. It returns None if the left parameter is equal to 0 or if the multiplication of left and right would result in an overflow. Otherwise, it returns Some(mul_value), where mul_value is the result of the multiplication.