referrerpolicy=no-referrer-when-downgrade

Trait frame_support::pallet_prelude::CheckedDiv

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

Performs division that returns None instead of panicking on division by zero and instead of wrapping around on underflow and overflow.

Required Methods§

source

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

Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl CheckedDiv for i8

source§

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

source§

impl CheckedDiv for i16

source§

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

source§

impl CheckedDiv for i32

source§

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

source§

impl CheckedDiv for i64

source§

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

source§

impl CheckedDiv for i128

source§

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

source§

impl CheckedDiv for isize

source§

impl CheckedDiv for u8

source§

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

source§

impl CheckedDiv for u16

source§

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

source§

impl CheckedDiv for u32

source§

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

source§

impl CheckedDiv for u64

source§

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

source§

impl CheckedDiv for u128

source§

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

source§

impl CheckedDiv for usize

source§

impl CheckedDiv for FixedI64

source§

impl CheckedDiv for FixedI128

source§

impl CheckedDiv for FixedU64

source§

impl CheckedDiv for FixedU128

source§

impl CheckedDiv for BigInt

source§

impl CheckedDiv for BigUint

§

impl CheckedDiv for U128

§

fn checked_div(&self, v: &U128) -> Option<U128>

§

impl CheckedDiv for U128

§

fn checked_div(&self, v: &U128) -> Option<U128>

§

impl CheckedDiv for U256

§

fn checked_div(&self, v: &U256) -> Option<U256>

§

impl CheckedDiv for U256

§

fn checked_div(&self, v: &U256) -> Option<U256>

§

impl CheckedDiv for U512

§

fn checked_div(&self, v: &U512) -> Option<U512>

§

impl CheckedDiv for U512

§

fn checked_div(&self, v: &U512) -> Option<U512>

source§

impl<T, D> CheckedDiv for TypeWithDefault<T, D>
where T: CheckedDiv, D: Get<T>,

source§

fn checked_div( &self, rhs: &TypeWithDefault<T, D>, ) -> Option<TypeWithDefault<T, D>>

Implementors§