Skip to main content

SafeMath

Trait SafeMath 

Source
pub trait SafeMath<T>: Sized {
    // Required methods
    fn safe_add(self, rhs: Self) -> Result<Self, LBError>;
    fn safe_mul(self, rhs: Self) -> Result<Self, LBError>;
    fn safe_div(self, rhs: Self) -> Result<Self, LBError>;
    fn safe_rem(self, rhs: Self) -> Result<Self, LBError>;
    fn safe_sub(self, rhs: Self) -> Result<Self, LBError>;
    fn safe_shl(self, offset: T) -> Result<Self, LBError>;
    fn safe_shr(self, offset: T) -> Result<Self, LBError>;
}

Required Methods§

Source

fn safe_add(self, rhs: Self) -> Result<Self, LBError>

Source

fn safe_mul(self, rhs: Self) -> Result<Self, LBError>

Source

fn safe_div(self, rhs: Self) -> Result<Self, LBError>

Source

fn safe_rem(self, rhs: Self) -> Result<Self, LBError>

Source

fn safe_sub(self, rhs: Self) -> Result<Self, LBError>

Source

fn safe_shl(self, offset: T) -> Result<Self, LBError>

Source

fn safe_shr(self, offset: T) -> Result<Self, LBError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SafeMath<u32> for i32

Source§

impl SafeMath<u32> for i64

Source§

impl SafeMath<u32> for i128

Source§

impl SafeMath<u32> for u16

Source§

impl SafeMath<u32> for u32

Source§

impl SafeMath<u32> for u64

Source§

impl SafeMath<u32> for u128

Source§

impl SafeMath<u32> for usize

Source§

impl SafeMath<usize> for U256

Implementors§