Performs multiplication that saturates at the numeric bounds instead of overflowing.

Signature

pub trait SaturatingMul

Examples

use core::num::traits::SaturatingMul;

assert!(100_u8.saturating_mul(3_u8) == 255);

Trait functions

saturating_mul

Saturating multiplication. Computes self * other, saturating at the relevant high or low boundary of the type.

Signature

fn saturating_mul(self: T, other: T) -> T