pub struct Currency { /* private fields */ }Implementations§
Source§impl Currency
impl Currency
Sourcepub fn from_iso(iso_code: &str) -> MoneyResult<Currency>
pub fn from_iso(iso_code: &str) -> MoneyResult<Currency>
Parse ISO 4217 currencies alphabetical code from string.
Case insensitive. E.g. “USD”, or “usd” or “uSd”
Sourcepub fn new(
code: &'static str,
symbol: &'static str,
name: &'static str,
minor_unit: u16,
) -> MoneyResult<Currency>
pub fn new( code: &'static str, symbol: &'static str, name: &'static str, minor_unit: u16, ) -> MoneyResult<Currency>
Create new currency.
It fails if the currency is already existed in ISO 4217 list.
Use Currency::from_iso instead to create ISO 4217 currency.
pub fn set_thousand_separator(&mut self, separator: &'static str)
pub fn set_decimal_separator(&mut self, separator: &'static str)
pub fn set_minor_symbol(&mut self, minor_symbol: &'static str)
pub fn set_numeric_code(&mut self, numeric_code: i32)
pub fn set_rounding_strategy(&mut self, strategy: RoundingStrategy)
pub fn set_countries(&mut self, countries: &'static [Country])
pub fn code(&self) -> &'static str
pub fn symbol(&self) -> &'static str
pub fn name(&self) -> &'static str
pub fn minor_unit(&self) -> u16
pub fn numeric_code(&self) -> i32
pub fn thousand_separator(&self) -> &'static str
pub fn decimal_separator(&self) -> &'static str
pub fn minor_symbol(&self) -> &'static str
pub fn rounding_strategy(&self) -> RoundingStrategy
pub fn countries(&self) -> Option<Vec<Country>>
Trait Implementations§
Source§impl PartialOrd for Currency
impl PartialOrd for Currency
impl Copy for Currency
impl Eq for Currency
Auto Trait Implementations§
impl Freeze for Currency
impl RefUnwindSafe for Currency
impl Send for Currency
impl Sync for Currency
impl Unpin for Currency
impl UnwindSafe for Currency
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