sp_runtime::traits

Trait CheckedMul

source
pub trait CheckedMul: Sized + Mul<Output = Self> {
    // Required method
    fn checked_mul(&self, v: &Self) -> Option<Self>;
}
Expand description

Performs multiplication that returns None instead of wrapping around on underflow or overflow.

Required Methods§

source

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

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl CheckedMul for i8

source§

fn checked_mul(&self, v: &i8) -> Option<i8>

source§

impl CheckedMul for i16

source§

fn checked_mul(&self, v: &i16) -> Option<i16>

source§

impl CheckedMul for i32

source§

fn checked_mul(&self, v: &i32) -> Option<i32>

source§

impl CheckedMul for i64

source§

fn checked_mul(&self, v: &i64) -> Option<i64>

source§

impl CheckedMul for i128

source§

fn checked_mul(&self, v: &i128) -> Option<i128>

source§

impl CheckedMul for isize

source§

impl CheckedMul for u8

source§

fn checked_mul(&self, v: &u8) -> Option<u8>

source§

impl CheckedMul for u16

source§

fn checked_mul(&self, v: &u16) -> Option<u16>

source§

impl CheckedMul for u32

source§

fn checked_mul(&self, v: &u32) -> Option<u32>

source§

impl CheckedMul for u64

source§

fn checked_mul(&self, v: &u64) -> Option<u64>

source§

impl CheckedMul for u128

source§

fn checked_mul(&self, v: &u128) -> Option<u128>

source§

impl CheckedMul for usize

Implementors§

source§

impl CheckedMul for FixedI64

source§

impl CheckedMul for FixedI128

source§

impl CheckedMul for FixedU64

source§

impl CheckedMul for FixedU128

source§

impl CheckedMul for PerU16

§Note

CheckedMul will never fail for PerThings.

source§

impl CheckedMul for Perbill

§Note

CheckedMul will never fail for PerThings.

source§

impl CheckedMul for Percent

§Note

CheckedMul will never fail for PerThings.

source§

impl CheckedMul for Permill

§Note

CheckedMul will never fail for PerThings.

source§

impl CheckedMul for Perquintill

§Note

CheckedMul will never fail for PerThings.

source§

impl<T: CheckedMul, D: Get<T>> CheckedMul for TypeWithDefault<T, D>