Struct Decimal128

Source
pub struct Decimal128(/* private fields */);
Expand description

128-bit decimal floating-point value.

Implementations§

Source§

impl Decimal128

Source

pub fn new(n: i64, s: i32) -> Self

Source

pub fn zero() -> Self

Source

pub fn is_zero(&self) -> bool

Source

pub fn one() -> Self

Source

pub fn two() -> Self

Source

pub fn ten() -> Self

Source

pub fn one_hundred() -> Self

Source

pub fn one_thousand() -> Self

Source

pub fn ln(&self) -> Decimal128

Source

pub fn exp(&self) -> Decimal128

Source

pub fn round_dp(&self, dp: i32) -> Self

Trait Implementations§

Source§

impl Add for Decimal128

Source§

type Output = Decimal128

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign for Decimal128

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for Decimal128

Source§

fn clone(&self) -> Decimal128

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Decimal128

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Converts Decimal128 into string in debug mode.

Source§

impl Default for Decimal128

Source§

fn default() -> Self

The default value of Decimal128 is 0 (zero).

Source§

impl Display for Decimal128

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Converts Decimal128 into human-readable string.

Source§

impl Div for Decimal128

Source§

type Output = Decimal128

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign for Decimal128

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl From<&str> for Decimal128

Source§

fn from(s: &str) -> Self

Converts Decimal128 from str.

Source§

impl From<i16> for Decimal128

Source§

fn from(n: i16) -> Self

Converts Decimal128 from i16.

Source§

impl From<i32> for Decimal128

Source§

fn from(n: i32) -> Self

Converts Decimal128 from i32.

Source§

impl From<i64> for Decimal128

Source§

fn from(n: i64) -> Self

Converts Decimal128 from i64.

Source§

impl From<i8> for Decimal128

Source§

fn from(n: i8) -> Self

Converts Decimal128 from i8.

Source§

impl From<isize> for Decimal128

Source§

fn from(n: isize) -> Self

Converts Decimal128 from isize.

Source§

impl From<u16> for Decimal128

Source§

fn from(n: u16) -> Self

Converts Decimal128 from u16.

Source§

impl From<u32> for Decimal128

Source§

fn from(n: u32) -> Self

Converts Decimal128 from u32.

Source§

impl From<u64> for Decimal128

Source§

fn from(n: u64) -> Self

Converts Decimal128 from u64.

Source§

impl From<u8> for Decimal128

Source§

fn from(n: u8) -> Self

Converts Decimal128 from u8.

Source§

impl From<usize> for Decimal128

Source§

fn from(n: usize) -> Self

Converts Decimal128 from usize.

Source§

impl FromStr for Decimal128

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Converts Decimal128 from str.

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

impl Mul for Decimal128

Source§

type Output = Decimal128

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign for Decimal128

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Neg for Decimal128

Source§

type Output = Decimal128

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Ord for Decimal128

Source§

fn cmp(&self, rhs: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
Source§

fn max(self, rhs: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
Source§

fn min(self, rhs: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Decimal128

Source§

fn eq(&self, rhs: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Decimal128

Source§

fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, rhs: &Self) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, rhs: &Self) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn gt(&self, rhs: &Self) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, rhs: &Self) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub for Decimal128

Source§

type Output = Decimal128

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign for Decimal128

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl Copy for Decimal128

Source§

impl Eq for Decimal128

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.