Trait Arithmetic

Source
pub trait Arithmetic: Sized {
    // Required methods
    fn add(&self, other: &Self) -> Result<Self>;
    fn sub(&self, other: &Self) -> Result<Self>;
    fn mul_scalar(&self, scalar: f64) -> Result<Self>;
    fn div_scalar(&self, scalar: f64) -> Result<Self>;
}
Expand description

Trait for objects that support arithmetic operations

Required Methods§

Source

fn add(&self, other: &Self) -> Result<Self>

Add two objects

Source

fn sub(&self, other: &Self) -> Result<Self>

Subtract two objects

Source

fn mul_scalar(&self, scalar: f64) -> Result<Self>

Multiply by scalar

Source

fn div_scalar(&self, scalar: f64) -> Result<Self>

Divide by scalar

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.

Implementors§