pub fn try_div(left_value: u128, right_value: u128) -> Option<u128>
Expand description
The try_div
function in Rust attempts to perform division on two u128
values and returns the
result as an Option<u128>
, or None
if the division is not exact.
Arguments:
left_value
: Theleft_value
parameter represents the dividend in a division operation. It is the number that is being divided.right_value
: Theright_value
parameter in thetry_div
function represents the divisor in a division operation. It is the value by which theleft_value
(dividend) will be divided. Ifright_value
is equal to 0, the function will returnNone
since division
Returns:
The function try_div
returns an Option<u128>
. It returns Some(result_mut)
if the division is
successful and the result is correct, otherwise it returns None
if the right_value
is 0 or if
the division result is incorrect.