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 const fn new_unchecked(numerator: u64, denominator: u64) -> ExchangeRate
pub const 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 const fn denominator(&self) -> u64
pub const 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 for ExchangeRate
impl PartialEq 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 ==
.source§impl Serial for ExchangeRate
impl Serial for ExchangeRate
impl Copy for ExchangeRate
impl Eq for ExchangeRate
impl StructuralPartialEq for ExchangeRate
Auto Trait Implementations§
impl Freeze for ExchangeRate
impl RefUnwindSafe for ExchangeRate
impl Send for ExchangeRate
impl Sync for ExchangeRate
impl Unpin for ExchangeRate
impl UnwindSafe for ExchangeRate
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
source§impl<D, S> DeserialWithState<S> for Dwhere
D: Deserial,
S: HasStateApi,
impl<D, S> DeserialWithState<S> for Dwhere
D: Deserial,
S: HasStateApi,
source§fn deserial_with_state<R>(_state: &S, source: &mut R) -> Result<D, ParseError>where
R: Read,
fn deserial_with_state<R>(_state: &S, source: &mut R) -> Result<D, ParseError>where
R: Read,
Attempt to read a structure from a given source and state, failing if
an error occurs during deserialization or reading.