Function chain_lib::calculator::try_add
source · pub fn try_add(left: u128, right: u128) -> Option<u128>
Expand description
The function try_add
in Rust attempts to add two u128
values and returns the sum as an
Option<u128>
if the result does not overflow.
Arguments:
left
:u128
- an unsigned 128-bit integer representing the left operand for addition.right
: Theright
parameter in thetry_add
function is of typeu128
, which represents an unsigned 128-bit integer.
Returns:
The function try_add
returns an Option<u128>
. It returns Some(add_value)
if the sum of left
and right
is greater than both left
and right
, otherwise it returns None
.