Struct oxsdatatypes::Decimal
source · pub struct Decimal { /* private fields */ }Expand description
It stores the decimal in a fix point encoding allowing nearly 18 digits before and 18 digits after “.”.
It stores the value in a i128 integer after multiplying it by 10¹⁸.
Implementations§
source§impl Decimal
impl Decimal
sourcepub const fn new(i: i128, n: u32) -> Result<Self, TooLargeForDecimalError>
pub const fn new(i: i128, n: u32) -> Result<Self, TooLargeForDecimalError>
Constructs the decimal i / 10^n
pub fn from_be_bytes(bytes: [u8; 16]) -> Self
pub fn to_be_bytes(self) -> [u8; 16]
sourcepub fn checked_add(self, rhs: impl Into<Self>) -> Option<Self>
pub fn checked_add(self, rhs: impl Into<Self>) -> Option<Self>
Returns None in case of overflow (FOAR0002).
sourcepub fn checked_sub(self, rhs: impl Into<Self>) -> Option<Self>
pub fn checked_sub(self, rhs: impl Into<Self>) -> Option<Self>
Returns None in case of overflow (FOAR0002).
sourcepub fn checked_mul(self, rhs: impl Into<Self>) -> Option<Self>
pub fn checked_mul(self, rhs: impl Into<Self>) -> Option<Self>
Returns None in case of overflow (FOAR0002).
sourcepub fn checked_div(self, rhs: impl Into<Self>) -> Option<Self>
pub fn checked_div(self, rhs: impl Into<Self>) -> Option<Self>
sourcepub fn checked_rem(self, rhs: impl Into<Self>) -> Option<Self>
pub fn checked_rem(self, rhs: impl Into<Self>) -> Option<Self>
sourcepub fn checked_rem_euclid(self, rhs: impl Into<Self>) -> Option<Self>
pub fn checked_rem_euclid(self, rhs: impl Into<Self>) -> Option<Self>
sourcepub fn checked_neg(self) -> Option<Self>
pub fn checked_neg(self) -> Option<Self>
Returns None in case of overflow (FOAR0002).
sourcepub fn checked_abs(self) -> Option<Self>
pub fn checked_abs(self) -> Option<Self>
sourcepub fn checked_round(self) -> Option<Self>
pub fn checked_round(self) -> Option<Self>
sourcepub fn checked_ceil(self) -> Option<Self>
pub fn checked_ceil(self) -> Option<Self>
Returns None in case of overflow (FOAR0002).
sourcepub fn checked_floor(self) -> Option<Self>
pub fn checked_floor(self) -> Option<Self>
pub const fn is_negative(self) -> bool
pub const fn is_positive(self) -> bool
sourcepub fn is_identical_with(self, other: Self) -> bool
pub fn is_identical_with(self, other: Self) -> bool
Checks if the two values are identical.
pub const MIN: Self = _
pub const MAX: Self = _
Trait Implementations§
source§impl FromStr for Decimal
impl FromStr for Decimal
§type Err = ParseDecimalError
type Err = ParseDecimalError
The associated error which can be returned from parsing.
source§impl Ord for Decimal
impl Ord for Decimal
source§impl PartialEq for Decimal
impl PartialEq for Decimal
source§impl PartialOrd for Decimal
impl PartialOrd for Decimal
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl TryFrom<Decimal> for Integer
impl TryFrom<Decimal> for Integer
§type Error = TooLargeForIntegerError
type Error = TooLargeForIntegerError
The type returned in the event of a conversion error.
source§impl TryFrom<Double> for Decimal
impl TryFrom<Double> for Decimal
§type Error = TooLargeForDecimalError
type Error = TooLargeForDecimalError
The type returned in the event of a conversion error.
source§impl TryFrom<Float> for Decimal
impl TryFrom<Float> for Decimal
§type Error = TooLargeForDecimalError
type Error = TooLargeForDecimalError
The type returned in the event of a conversion error.
source§impl TryFrom<i128> for Decimal
impl TryFrom<i128> for Decimal
§type Error = TooLargeForDecimalError
type Error = TooLargeForDecimalError
The type returned in the event of a conversion error.
source§impl TryFrom<u128> for Decimal
impl TryFrom<u128> for Decimal
§type Error = TooLargeForDecimalError
type Error = TooLargeForDecimalError
The type returned in the event of a conversion error.
impl Copy for Decimal
impl Eq for Decimal
impl StructuralEq for Decimal
impl StructuralPartialEq for Decimal
Auto Trait Implementations§
impl RefUnwindSafe for Decimal
impl Send for Decimal
impl Sync for Decimal
impl Unpin for Decimal
impl UnwindSafe for Decimal
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more