safe_div

Function safe_div 

Source
pub fn safe_div<T: SafeDiv>(a: T, b: T) -> Result<T, SafeMathError>
Expand description

Performs safe division with division-by-zero checking.

Used internally by the #[safe_math] macro during expansion. This function delegates to the appropriate trait method.

§Arguments

  • a - First operand.
  • b - Second operand.

§Returns

Ok(result) on success, Err(SafeMathError::DivisionByZero) on error.