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§
sourcefn into_decimal256(self) -> Decimal256
fn into_decimal256(self) -> Decimal256
Convert into the underlying Decimal256.
sourcefn from_decimal256(src: Decimal256) -> Self
fn from_decimal256(src: Decimal256) -> Self
Convert from a Decimal256.
Provided Methods§
sourcefn checked_add(self, rhs: Self) -> Result<Self, OverflowError>
fn checked_add(self, rhs: Self) -> Result<Self, OverflowError>
Add two values together
sourcefn checked_add_signed(self, rhs: Signed<Self>) -> Result<Self>
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.
sourcefn checked_sub(self, rhs: Self) -> Result<Self, OverflowError>
fn checked_sub(self, rhs: Self) -> Result<Self, OverflowError>
Subtract two values
sourcefn try_from_number(_: Signed<Decimal256>) -> Result<Self>
fn try_from_number(_: Signed<Decimal256>) -> Result<Self>
Try to convert from a general purpose Number
sourcefn into_number(self) -> Signed<Decimal256>
fn into_number(self) -> Signed<Decimal256>
convert into a general purpose Number
sourcefn into_signed(self) -> Signed<Self>
fn into_signed(self) -> Signed<Self>
Convert into a positive Signed value.
Object Safety§
This trait is not object safe.