Function chain_lib::calculator::try_div
source · pub fn try_div(left: u128, right: u128) -> Option<u128>
Expand description
The function try_div
in Rust attempts to divide two u128
numbers and returns the result as an
Option<u128>
, or None
if the division is not exact.
Arguments:
left
: Theleft
parameter represents the dividend in a division operation.right
: Theright
parameter represents the divisor in the division operation.
Returns:
The function try_div
returns an Option<u128>
. It returns None
if the right
parameter is
equal to 0 or if the division does not result in a whole number quotient. It returns
Some(mul_value)
if the division results in a whole number quotient.