pub trait Currency {
// Required methods
fn code(&self) -> &'static str;
fn minor_units(&self) -> u32;
fn numeric_code(&self) -> u32;
}Expand description
Common trait for all currencies.
Required Methods§
Sourcefn code(&self) -> &'static str
fn code(&self) -> &'static str
Returns the unique ISO alphabetic code for this currency (e.g., “USD” or “JPY”).
Sourcefn minor_units(&self) -> u32
fn minor_units(&self) -> u32
Returns the number of minor units supported by the currency. Currencies like USD and EUR currently support 2, but others like JPY or KRW support zero.
Sourcefn numeric_code(&self) -> u32
fn numeric_code(&self) -> u32
Returns the unique ISO numeric code for this currency.
Trait Implementations§
Source§impl Debug for &dyn Currency
Debug output for a dynamically-typed Currency.
Only prints the code since that is unique.
impl Debug for &dyn Currency
Debug output for a dynamically-typed Currency. Only prints the code since that is unique.
Source§impl MinorUnits for &dyn Currency
Blanket implementation of MinorUnits for an &dyn Currency.
impl MinorUnits for &dyn Currency
Blanket implementation of MinorUnits for an &dyn Currency.