Struct concordium_std::ExchangeRate
source · pub struct ExchangeRate { /* private fields */ }
Expand description
An exchange rate between two quantities. This is never 0, and the exchange rate should also never be infinite.
Implementations§
source§impl ExchangeRate
impl ExchangeRate
sourcepub fn new_unchecked(numerator: u64, denominator: u64) -> ExchangeRate
pub fn new_unchecked(numerator: u64, denominator: u64) -> ExchangeRate
Construct an unchecked exchange rate from a numerator and denominator. The numerator and denominator must both be non-zero, and they have to be in reduced form.
sourcepub fn denominator(&self) -> u64
pub fn denominator(&self) -> u64
Get the denominator. This is never 0.
Trait Implementations§
source§impl Clone for ExchangeRate
impl Clone for ExchangeRate
source§fn clone(&self) -> ExchangeRate
fn clone(&self) -> ExchangeRate
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ExchangeRate
impl Debug for ExchangeRate
source§impl Deserial for ExchangeRate
impl Deserial for ExchangeRate
source§fn deserial<R>(source: &mut R) -> Result<ExchangeRate, ParseError>where
R: Read,
fn deserial<R>(source: &mut R) -> Result<ExchangeRate, ParseError>where R: Read,
Attempt to read a structure from a given source, failing if an error
occurs during deserialization or reading.
source§impl PartialEq<ExchangeRate> for ExchangeRate
impl PartialEq<ExchangeRate> for ExchangeRate
source§fn eq(&self, other: &ExchangeRate) -> bool
fn eq(&self, other: &ExchangeRate) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.