Module chain_lib::calculator
source · Expand description
pub mod calculator; is a Rust code snippet that declares a module named calculator and makes it
public (pub). This means that the contents of the calculator module can be accessed from outside
the current module or crate.
Functions
- The function
try_addin Rust attempts to add twou128values and returns the sum as anOption<u128>if the result does not overflow. - The function
try_divin Rust attempts to divide twou128numbers and returns the result as anOption<u128>, orNoneif the division is not exact. - This Rust function calculates the remainder of dividing one unsigned 128-bit integer by another, returning an
Optionwith the result orNoneif the divisor is zero. - The function
try_mulin Rust attempts to multiply twou128numbers and returns the result as anOption<u128>, ensuring no overflow occurs. - The function
try_subin Rust attempts to subtract twou128values and returns the result if it is greater than the second value, otherwise it returnsNone.