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, Error> { ... } fn checked_sub(self, rhs: Self) -> Result<Self, OverflowError> { ... } fn try_from_number(_: Signed<Decimal256>) -> Result<Self, Error> { ... } 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§

fn into_decimal256(self) -> Decimal256

Convert into the underlying Decimal256.

fn from_decimal256(src: Decimal256) -> Self

Convert from a Decimal256.

Provided Methods§

fn is_zero(&self) -> bool

Check if the underlying value is 0.

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

Add two values together

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

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

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

Subtract two values

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

Try to convert from a general purpose Number

fn into_number(self) -> Signed<Decimal256>

convert into a general purpose Number

fn into_signed(self) -> Signed<Self>

Convert into a positive Signed value.

fn zero() -> Self

The value 0

fn two() -> Self

The value 2

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

Difference between two values

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

Is the delta between these less than the epsilon value?

Epsilon is 10^-7

Object Safety§

This trait is not object safe.

Implementors§