Struct rust_decimal::Decimal
[−]
[src]
pub struct Decimal { /* fields omitted */ }
128 bit representation of a decimal The finite set of values of type Decimal are of the form m / 10e, where m is an integer such that -296 <; m <; 296, and e is an integer between 0 and 28 inclusive.
Methods
impl Decimal
[src]
fn new(num: i64, scale: u32) -> Decimal
fn scale(&self) -> u32
fn set_sign(&mut self, positive: bool)
fn unsigned_bytes_le(&self) -> Vec<u8>
fn serialize(&self) -> [u8; 16]
fn deserialize(bytes: [u8; 16]) -> Decimal
fn is_negative(&self) -> bool
fn is_positive(&self) -> bool
fn min_value() -> Decimal
fn max_value() -> Decimal
fn round(&self) -> Decimal
fn round_dp(&self, dp: u32) -> Decimal
Trait Implementations
impl<'de> Deserialize<'de> for Decimal
[src]
fn deserialize<D>(deserializer: D) -> Result<Decimal, D::Error> where
D: Deserializer<'de>,
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Serialize for Decimal
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Clone for Decimal
[src]
fn clone(&self) -> Decimal
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Decimal
[src]
impl Copy for Decimal
[src]
impl Zero for Decimal
[src]
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
fn zero() -> Decimal
Returns the additive identity element of Self
, 0
. Read more
impl One for Decimal
[src]
impl FromStr for Decimal
[src]
type Err = &'static str
The associated error which can be returned from parsing.
fn from_str(value: &str) -> Result<Decimal, &'static str>
Parses a string s
to return a value of this type. Read more
impl ToString for Decimal
[src]
impl FromPrimitive for Decimal
[src]
fn from_i32(n: i32) -> Option<Decimal>
Convert an i32
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_i64(n: i64) -> Option<Decimal>
Convert an i64
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_u32(n: u32) -> Option<Decimal>
Convert an u32
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_u64(n: u64) -> Option<Decimal>
Convert an u64
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_isize(n: isize) -> Option<Self>
Convert an isize
to return an optional value of this type. If the value cannot be represented by this value, the None
is returned. Read more
fn from_i8(n: i8) -> Option<Self>
Convert an i8
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_i16(n: i16) -> Option<Self>
Convert an i16
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_usize(n: usize) -> Option<Self>
Convert a usize
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_u8(n: u8) -> Option<Self>
Convert an u8
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_u16(n: u16) -> Option<Self>
Convert an u16
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_f32(n: f32) -> Option<Self>
Convert a f32
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_f64(n: f64) -> Option<Self>
Convert a f64
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
impl ToPrimitive for Decimal
[src]
fn to_i64(&self) -> Option<i64>
Converts the value of self
to an i64
.
fn to_u64(&self) -> Option<u64>
Converts the value of self
to an u64
.
fn to_isize(&self) -> Option<isize>
Converts the value of self
to an isize
.
fn to_i8(&self) -> Option<i8>
Converts the value of self
to an i8
.
fn to_i16(&self) -> Option<i16>
Converts the value of self
to an i16
.
fn to_i32(&self) -> Option<i32>
Converts the value of self
to an i32
.
fn to_usize(&self) -> Option<usize>
Converts the value of self
to a usize
.
fn to_u8(&self) -> Option<u8>
Converts the value of self
to an u8
.
fn to_u16(&self) -> Option<u16>
Converts the value of self
to an u16
.
fn to_u32(&self) -> Option<u32>
Converts the value of self
to an u32
.
fn to_f32(&self) -> Option<f32>
Converts the value of self
to an f32
.
fn to_f64(&self) -> Option<f64>
Converts the value of self
to an f64
.
impl Add<Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the +
operator
fn add(self, other: Decimal) -> Decimal
The method for the +
operator
impl<'a> Add<Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the +
operator
fn add(self, other: Decimal) -> Decimal
The method for the +
operator
impl<'a> Add<&'a Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the +
operator
fn add(self, other: &Decimal) -> Decimal
The method for the +
operator
impl<'a, 'b> Add<&'b Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the +
operator
fn add(self, other: &Decimal) -> Decimal
The method for the +
operator
impl Sub<Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the -
operator
fn sub(self, other: Decimal) -> Decimal
The method for the -
operator
impl<'a> Sub<Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the -
operator
fn sub(self, other: Decimal) -> Decimal
The method for the -
operator
impl<'a> Sub<&'a Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the -
operator
fn sub(self, other: &Decimal) -> Decimal
The method for the -
operator
impl<'a, 'b> Sub<&'b Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the -
operator
fn sub(self, other: &Decimal) -> Decimal
The method for the -
operator
impl Mul<Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the *
operator
fn mul(self, other: Decimal) -> Decimal
The method for the *
operator
impl<'a> Mul<Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the *
operator
fn mul(self, other: Decimal) -> Decimal
The method for the *
operator
impl<'a> Mul<&'a Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the *
operator
fn mul(self, other: &Decimal) -> Decimal
The method for the *
operator
impl<'a, 'b> Mul<&'b Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the *
operator
fn mul(self, other: &Decimal) -> Decimal
The method for the *
operator
impl Div<Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the /
operator
fn div(self, other: Decimal) -> Decimal
The method for the /
operator
impl<'a> Div<Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the /
operator
fn div(self, other: Decimal) -> Decimal
The method for the /
operator
impl<'a> Div<&'a Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the /
operator
fn div(self, other: &Decimal) -> Decimal
The method for the /
operator
impl<'a, 'b> Div<&'b Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the /
operator
fn div(self, other: &Decimal) -> Decimal
The method for the /
operator
impl Rem<Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the %
operator
fn rem(self, other: Decimal) -> Decimal
The method for the %
operator
impl<'a> Rem<Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the %
operator
fn rem(self, other: Decimal) -> Decimal
The method for the %
operator
impl<'a> Rem<&'a Decimal> for Decimal
[src]
type Output = Decimal
The resulting type after applying the %
operator
fn rem(self, other: &Decimal) -> Decimal
The method for the %
operator
impl<'a, 'b> Rem<&'b Decimal> for &'a Decimal
[src]
type Output = Decimal
The resulting type after applying the %
operator
fn rem(self, other: &Decimal) -> Decimal
The method for the %
operator
impl PartialEq for Decimal
[src]
fn eq(&self, other: &Decimal) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Eq for Decimal
[src]
impl PartialOrd for Decimal
[src]
fn partial_cmp(&self, other: &Decimal) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more