dime

Types

pub opaque type Currency

Types of errors that can be encountered when parsing a currency from it’s code (alpha or numeric).

pub type CurrencyCodeError {
  InvalidFormat
  UnrecognizedCode
}

Constructors

  • InvalidFormat
  • UnrecognizedCode

Constants

pub const aed: Currency
pub const afn: Currency
pub const all: Currency
pub const amd: Currency
pub const ang: Currency
pub const aoa: Currency
pub const ars: Currency
pub const aud: Currency
pub const awg: Currency
pub const azn: Currency
pub const bam: Currency
pub const bbd: Currency
pub const bdt: Currency
pub const bgn: Currency
pub const bhd: Currency
pub const bif: Currency
pub const bmd: Currency
pub const bnd: Currency
pub const bob: Currency
pub const brl: Currency
pub const bsd: Currency
pub const btn: Currency
pub const bwp: Currency
pub const byn: Currency
pub const bzd: Currency
pub const cad: Currency
pub const cdf: Currency
pub const chf: Currency
pub const clp: Currency
pub const cny: Currency
pub const cop: Currency
pub const crc: Currency
pub const cuc: Currency
pub const cup: Currency
pub const cve: Currency
pub const czk: Currency
pub const djf: Currency
pub const dkk: Currency
pub const dop: Currency
pub const dzd: Currency
pub const egp: Currency
pub const ern: Currency
pub const etb: Currency
pub const eur: Currency
pub const fjd: Currency
pub const fkp: Currency
pub const gbp: Currency
pub const gel: Currency
pub const ghs: Currency
pub const gip: Currency
pub const gmd: Currency
pub const gnf: Currency
pub const gtq: Currency
pub const gyd: Currency
pub const hkd: Currency
pub const hnl: Currency
pub const hrk: Currency
pub const htg: Currency
pub const huf: Currency
pub const idr: Currency
pub const ils: Currency
pub const inr: Currency
pub const iqd: Currency
pub const irr: Currency
pub const isk: Currency
pub const jmd: Currency
pub const jod: Currency
pub const jpy: Currency
pub const kes: Currency
pub const kgs: Currency
pub const khr: Currency
pub const kmf: Currency
pub const kpw: Currency
pub const krw: Currency
pub const kwd: Currency
pub const kyd: Currency
pub const kzt: Currency
pub const lak: Currency
pub const lbp: Currency
pub const lkr: Currency
pub const lrd: Currency
pub const lsl: Currency
pub const lyd: Currency
pub const mad: Currency
pub const mdl: Currency
pub const mga: Currency
pub const mkd: Currency
pub const mmk: Currency
pub const mnt: Currency
pub const mop: Currency
pub const mru: Currency
pub const mur: Currency
pub const mvr: Currency
pub const mwk: Currency
pub const mxn: Currency
pub const myr: Currency
pub const mzn: Currency
pub const nad: Currency
pub const ngn: Currency
pub const nio: Currency
pub const nok: Currency
pub const npr: Currency
pub const nzd: Currency
pub const omr: Currency
pub const pab: Currency
pub const pen: Currency
pub const pgk: Currency
pub const php: Currency
pub const pkr: Currency
pub const pln: Currency
pub const pyg: Currency
pub const qar: Currency
pub const ron: Currency
pub const rsd: Currency
pub const rub: Currency
pub const rwf: Currency
pub const sar: Currency
pub const sbd: Currency
pub const scr: Currency
pub const sdg: Currency
pub const sek: Currency
pub const sgd: Currency
pub const shp: Currency
pub const sle: Currency
pub const sos: Currency
pub const srd: Currency
pub const ssp: Currency
pub const stn: Currency
pub const svc: Currency
pub const syp: Currency
pub const szl: Currency
pub const thb: Currency
pub const tjs: Currency
pub const tmt: Currency
pub const tnd: Currency
pub const top: Currency
pub const try: Currency
pub const ttd: Currency
pub const twd: Currency
pub const tzs: Currency
pub const uah: Currency
pub const ugx: Currency
pub const usd: Currency
pub const uyu: Currency
pub const uyw: Currency
pub const uzs: Currency
pub const ved: Currency
pub const ves: Currency
pub const vnd: Currency
pub const vuv: Currency
pub const wst: Currency
pub const xaf: Currency
pub const xcd: Currency
pub const xof: Currency
pub const xpf: Currency
pub const yer: Currency
pub const zar: Currency
pub const zmw: Currency
pub const zwg: Currency

Functions

pub fn alpha_code(currency: Currency) -> String

Get the 3 character alphabetic code for the currency.

pub fn display_name(currency: Currency) -> String

Get the display name of the currency in English.

pub fn from_alpha_code(
  currency_code: String,
) -> Result(Currency, CurrencyCodeError)

Try and retrieve a currency by it’s 3 character alphabetic code.

pub fn from_numeric_code(
  currency_code: String,
) -> Result(Currency, CurrencyCodeError)

Try and retrieve a currency by it’s 3 character numeric code.

pub fn known_currencies() -> List(Currency)

Retrieve the list of all the currencies known to this library.

pub fn minor_units(currency: Currency) -> Int

The decimal relationship between the currency and it’s minor unit, e.g. euro and euro cent.

1, 2 and 3 signify a ratio of 10:1, 100:1 and 1000:1 respectively.

pub fn numeric_code(currency: Currency) -> String

Get the 3 character numeric code for the currency.

pub fn symbol(currency: Currency) -> String

Get the graphical symbol used as a shorthand representation of the specific currency unit.

Search Document