pub trait ArithmeticOps<T>: Copy {
    // Required methods
    fn add(self, other: T) -> T;
    fn sub(self, other: T) -> T;
    fn mul(self, other: T) -> T;
    fn div(self, other: T) -> Result<T, TrapCode>;
}
Expand description

Arithmetic operations.

Required Methods§

source

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

Add two values.

source

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

Subtract two values.

source

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

Multiply two values.

source

fn div(self, other: T) -> Result<T, TrapCode>

Divide two values.

Implementations on Foreign Types§

source§

impl ArithmeticOps<i32> for i32

source§

fn add(self, other: i32) -> i32

source§

fn sub(self, other: i32) -> i32

source§

fn mul(self, other: i32) -> i32

source§

fn div(self, other: i32) -> Result<i32, TrapCode>

source§

impl ArithmeticOps<f64> for f64

source§

fn add(self, other: f64) -> f64

source§

fn sub(self, other: f64) -> f64

source§

fn mul(self, other: f64) -> f64

source§

fn div(self, other: f64) -> Result<f64, TrapCode>

source§

impl ArithmeticOps<f32> for f32

source§

fn add(self, other: f32) -> f32

source§

fn sub(self, other: f32) -> f32

source§

fn mul(self, other: f32) -> f32

source§

fn div(self, other: f32) -> Result<f32, TrapCode>

source§

impl ArithmeticOps<u64> for u64

source§

fn add(self, other: u64) -> u64

source§

fn sub(self, other: u64) -> u64

source§

fn mul(self, other: u64) -> u64

source§

fn div(self, other: u64) -> Result<u64, TrapCode>

source§

impl ArithmeticOps<u32> for u32

source§

fn add(self, other: u32) -> u32

source§

fn sub(self, other: u32) -> u32

source§

fn mul(self, other: u32) -> u32

source§

fn div(self, other: u32) -> Result<u32, TrapCode>

source§

impl ArithmeticOps<i64> for i64

source§

fn add(self, other: i64) -> i64

source§

fn sub(self, other: i64) -> i64

source§

fn mul(self, other: i64) -> i64

source§

fn div(self, other: i64) -> Result<i64, TrapCode>

Implementors§