UnsignedDecimal

Trait UnsignedDecimal 

Source
pub trait UnsignedDecimal:
    Display
    + Debug
    + Serialize
    + DeserializeOwned
    + Copy
    + Ord
    + FromStr
    + Default {
Show 13 methods // Required methods fn into_decimal256(self) -> Decimal256; fn from_decimal256(src: Decimal256) -> Self; // Provided methods fn is_zero(&self) -> bool { ... } fn checked_add(self, rhs: Self) -> Result<Self, OverflowError> { ... } fn checked_add_signed(self, rhs: Signed<Self>) -> Result<Self> { ... } fn checked_sub(self, rhs: Self) -> Result<Self, OverflowError> { ... } fn try_from_number(_: Signed<Decimal256>) -> Result<Self> { ... } fn into_number(self) -> Signed<Decimal256> { ... } fn into_signed(self) -> Signed<Self> { ... } fn zero() -> Self { ... } fn two() -> Self { ... } fn diff(self, rhs: Self) -> Self { ... } fn approx_eq(self, rhs: Self) -> bool { ... }
}
Expand description

Generalizes any newtype wrapper around a Decimal256.

Required Methods§

Source

fn into_decimal256(self) -> Decimal256

Convert into the underlying Decimal256.

Source

fn from_decimal256(src: Decimal256) -> Self

Convert from a Decimal256.

Provided Methods§

Source

fn is_zero(&self) -> bool

Check if the underlying value is 0.

Source

fn checked_add(self, rhs: Self) -> Result<Self, OverflowError>

Add two values together

Source

fn checked_add_signed(self, rhs: Signed<Self>) -> Result<Self>

Try to add a signed value to this, erroring if it results in a negative result.

Source

fn checked_sub(self, rhs: Self) -> Result<Self, OverflowError>

Subtract two values

Source

fn try_from_number(_: Signed<Decimal256>) -> Result<Self>

Try to convert from a general purpose Number

Source

fn into_number(self) -> Signed<Decimal256>

convert into a general purpose Number

Source

fn into_signed(self) -> Signed<Self>

Convert into a positive Signed value.

Source

fn zero() -> Self

The value 0

Source

fn two() -> Self

The value 2

Source

fn diff(self, rhs: Self) -> Self

Difference between two values

Source

fn approx_eq(self, rhs: Self) -> bool

Is the delta between these less than the epsilon value?

Epsilon is 10^-7

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§