CheckedMul

Trait CheckedMul 

Source
pub trait CheckedMul: Mul + Sized {
    // Required method
    fn checked_mul(self, rhs: Self) -> Option<Self>;
}
Expand description

Performs checked multiplication. Maps directly to the integers checked_mul method. (i.e. u8::checked_mul) Consult the docs of the primitive methods to learn more.

Required Methods§

Source

fn checked_mul(self, rhs: Self) -> Option<Self>

performs checked mul

§Example
let a = 2u8;
let b = 1u8;

assert_eq!(CheckedMul::checked_mul(a, b), a.checked_mul(b));
assert_eq!(CheckedMul::checked_mul(a, u8::MAX), a.checked_mul(u8::MAX));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CheckedMul for i8

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Source§

impl CheckedMul for i16

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Source§

impl CheckedMul for i32

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Source§

impl CheckedMul for i64

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Source§

impl CheckedMul for u8

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Source§

impl CheckedMul for u16

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Source§

impl CheckedMul for u32

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Source§

impl CheckedMul for u64

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Implementors§