Struct bitcoin::util::decimal::Decimal [−][src]
pub struct Decimal { /* fields omitted */ }
A fixed-point decimal type
Methods
impl Decimal
[src]
impl Decimal
pub fn new(mantissa: i64, exponent: usize) -> Decimal
[src]
pub fn new(mantissa: i64, exponent: usize) -> Decimal
Creates a new Decimal
pub fn mantissa(&self) -> i64
[src]
pub fn mantissa(&self) -> i64
Returns the mantissa
pub fn exponent(&self) -> usize
[src]
pub fn exponent(&self) -> usize
Returns the exponent
pub fn integer_value(&self, exponent: usize) -> i64
[src]
pub fn integer_value(&self, exponent: usize) -> i64
Get the decimal's value in an integer type, by multiplying
by some power of ten to ensure the returned value is 10 **
exponent
types the actual value.
pub fn nonnegative(&self) -> bool
[src]
pub fn nonnegative(&self) -> bool
Returns whether or not the number is nonnegative
Trait Implementations
impl Copy for Decimal
[src]
impl Copy for Decimal
impl Clone for Decimal
[src]
impl Clone for Decimal
fn clone(&self) -> Decimal
[src]
fn clone(&self) -> Decimal
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Decimal
[src]
impl Debug for Decimal
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for Decimal
[src]
impl Eq for Decimal
impl Ord for Decimal
[src]
impl Ord for Decimal
fn cmp(&self, other: &Decimal) -> Ordering
[src]
fn cmp(&self, other: &Decimal) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialEq<Decimal> for Decimal
[src]
impl PartialEq<Decimal> for Decimal
fn eq(&self, other: &Decimal) -> bool
[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[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialOrd<Decimal> for Decimal
[src]
impl PartialOrd<Decimal> for Decimal
fn partial_cmp(&self, other: &Decimal) -> Option<Ordering>
[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[src]
fn lt(&self, other: &Rhs) -> bool
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[src]
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 more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
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[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Display for Decimal
[src]
impl Display for Decimal
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Add for Decimal
[src]
impl Add for Decimal
type Output = Decimal
The resulting type after applying the +
operator.
fn add(self, other: Decimal) -> Decimal
[src]
fn add(self, other: Decimal) -> Decimal
Performs the +
operation.
impl Neg for Decimal
[src]
impl Neg for Decimal
type Output = Decimal
The resulting type after applying the -
operator.
fn neg(self) -> Decimal
[src]
fn neg(self) -> Decimal
Performs the unary -
operation.
impl Sub for Decimal
[src]
impl Sub for Decimal