Skip to main content

BaseOps

Trait BaseOps 

Source
pub trait BaseOps:
    Sized
    + BaseMoney
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssign
    + Neg<Output = Self> {
    // Required methods
    fn abs(&self) -> Self;
    fn min(&self, rhs: Self) -> Self;
    fn max(&self, rhs: Self) -> Self;
    fn clamp(&self, from: Decimal, to: Decimal) -> Self;
    fn add(&self, rhs: Decimal) -> MoneyResult<Self>;
    fn sub(&self, rhs: Decimal) -> MoneyResult<Self>;
    fn mul(&self, rhs: Decimal) -> MoneyResult<Self>;
    fn div(&self, rhs: Decimal) -> MoneyResult<Self>;
}

Required Methods§

Source

fn abs(&self) -> Self

make money positive

Source

fn min(&self, rhs: Self) -> Self

Source

fn max(&self, rhs: Self) -> Self

Source

fn clamp(&self, from: Decimal, to: Decimal) -> Self

clamp the money amount between from and to inclusively.

Source

fn add(&self, rhs: Decimal) -> MoneyResult<Self>

Source

fn sub(&self, rhs: Decimal) -> MoneyResult<Self>

Source

fn mul(&self, rhs: Decimal) -> MoneyResult<Self>

Source

fn div(&self, rhs: Decimal) -> MoneyResult<Self>

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§