CurrencyCode

Enum CurrencyCode 

Source
#[non_exhaustive]
#[repr(u16)]
pub enum CurrencyCode {
Show 179 variants AED = 784, AFN = 971, ALL = 8, AMD = 51, ANG = 532, AOA = 973, ARS = 32, AUD = 36, AWG = 533, AZN = 944, BAM = 977, BBD = 52, BDT = 50, BGN = 975, BHD = 48, BIF = 108, BMD = 60, BND = 96, BOB = 68, BOV = 984, BRL = 986, BSD = 44, BTN = 64, BWP = 72, BYN = 933, BZD = 84, CAD = 124, CDF = 976, CHE = 947, CHF = 756, CHW = 948, CLF = 990, CLP = 152, CNY = 156, COP = 170, COU = 970, CRC = 188, CUP = 192, CVE = 132, CZK = 203, DJF = 262, DKK = 208, DOP = 214, DZD = 12, EGP = 818, ERN = 232, ETB = 230, EUR = 978, FJD = 242, FKP = 238, GBP = 826, GEL = 981, GHS = 936, GIP = 292, GMD = 270, GNF = 324, GTQ = 320, GYD = 328, HKD = 344, HNL = 340, HTG = 332, HUF = 348, IDR = 360, ILS = 376, INR = 356, IQD = 368, IRR = 364, ISK = 352, JMD = 388, JOD = 400, JPY = 392, KES = 404, KGS = 417, KHR = 116, KMF = 174, KPW = 408, KRW = 410, KWD = 414, KYD = 136, KZT = 398, LAK = 418, LBP = 422, LKR = 144, LRD = 430, LSL = 426, LYD = 434, MAD = 504, MDL = 498, MGA = 969, MKD = 807, MMK = 104, MNT = 496, MOP = 446, MRU = 929, MUR = 480, MVR = 462, MWK = 454, MXN = 484, MXV = 979, MYR = 458, MZN = 943, NAD = 516, NGN = 566, NIO = 558, NOK = 578, NPR = 524, NZD = 554, OMR = 512, PAB = 590, PEN = 604, PGK = 598, PHP = 608, PKR = 586, PLN = 985, PYG = 600, QAR = 634, RON = 946, RSD = 941, RUB = 643, RWF = 646, SAR = 682, SBD = 90, SCR = 690, SDG = 938, SEK = 752, SGD = 702, SHP = 654, SLE = 925, SLL = 694, SOS = 706, SRD = 968, SSP = 728, STN = 930, SVC = 222, SYP = 760, SZL = 748, THB = 764, TJS = 972, TMT = 934, TND = 788, TOP = 776, TRY = 949, TTD = 780, TWD = 901, TZS = 834, UAH = 980, UGX = 800, USD = 840, USN = 997, UYI = 940, UYU = 858, UYW = 927, UZS = 860, VED = 926, VES = 928, VND = 704, VUV = 548, WST = 882, XAF = 950, XAG = 961, XAU = 959, XBA = 955, XBB = 956, XBC = 957, XBD = 958, XCD = 951, XDR = 960, XOF = 952, XPD = 964, XPF = 953, XPT = 962, XSU = 994, XTS = 963, XUA = 965, XXX = 999, YER = 886, ZAR = 710, ZMW = 967, ZWL = 932,
}
Expand description

The possible currencies’ codes.

These codes are based on the ISO 4217 standard, which defines codes of three characters to represent currencies used by countries and territories. There are both alphabetic and numeric codes, using either three letters or three numbers.

§Alphabetic codes

The alphabetic codes are based on the ISO 3166-1 alpha-2 country codes, with the first two letters of the ISO 4217 three-letter code being the same as the code for the country name.

§Numeric codes

The three-digit numeric code is a useful alternative when the three-letter code may not be appropriate. Interestingly, the three-digit numeric code is the same as the numeric country code where possible.

§Data sources

The list of codes is available from the ISO site, and from Wikipedia.

§See also

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

AED = 784

United Arab Emirates dirham.

§

AFN = 971

Afghan afghani.

§

ALL = 8

Albanian lek.

§

AMD = 51

Armenian dram.

§

ANG = 532

Netherlands Antillean guilder.

§

AOA = 973

Angolan kwanza.

§

ARS = 32

Argentine peso.

§

AUD = 36

Australian dollar.

§

AWG = 533

Aruban florin.

§

AZN = 944

Azerbaijani manat.

§

BAM = 977

Bosnia and Herzegovina convertible mark.

§

BBD = 52

Barbados dollar.

§

BDT = 50

Bangladeshi taka.

§

BGN = 975

Bulgarian lev.

§

BHD = 48

Bahraini dinar.

§

BIF = 108

Burundian franc.

§

BMD = 60

Bermudian dollar.

§

BND = 96

Brunei dollar.

§

BOB = 68

Boliviano.

§

BOV = 984

Bolivian Mvdol.

§

BRL = 986

Brazilian real.

§

BSD = 44

Bahamian dollar.

§

BTN = 64

Bhutanese ngultrum.

§

BWP = 72

Botswana pula.

§

BYN = 933

Belarusian ruble.

§

BZD = 84

Belize dollar.

§

CAD = 124

Canadian dollar.

§

CDF = 976

Congolese franc.

§

CHE = 947

WIR euro.

§

CHF = 756

Swiss franc.

§

CHW = 948

WIR franc.

§

CLF = 990

Unidad de Fomento.

§

CLP = 152

Chilean peso.

§

CNY = 156

Renminbi.

§

COP = 170

Colombian peso.

§

COU = 970

Unidad de Valor Real (UVR).

§

CRC = 188

Costa Rican colon.

§

CUP = 192

Cuban peso.

§

CVE = 132

Cape Verdean escudo.

§

CZK = 203

Czech koruna.

§

DJF = 262

Djiboutian franc.

§

DKK = 208

Danish krone.

§

DOP = 214

Dominican peso.

§

DZD = 12

Algerian dinar.

§

EGP = 818

Egyptian pound.

§

ERN = 232

Eritrean nakfa.

§

ETB = 230

Ethiopian birr.

§

EUR = 978

Euro.

§

FJD = 242

Fiji dollar.

§

FKP = 238

Falkland Islands pound.

§

GBP = 826

Pound sterling.

§

GEL = 981

Georgian lari.

§

GHS = 936

Ghanaian cedi.

§

GIP = 292

Gibraltar pound.

§

GMD = 270

Gambian dalasi.

§

GNF = 324

Guinean franc.

§

GTQ = 320

Guatemalan quetzal.

§

GYD = 328

Guyanese dollar.

§

HKD = 344

Hong Kong dollar.

§

HNL = 340

Honduran lempira.

§

HTG = 332

Haitian gourde.

§

HUF = 348

Hungarian forint.

§

IDR = 360

Indonesian rupiah.

§

ILS = 376

Israeli new shekel.

§

INR = 356

Indian rupee.

§

IQD = 368

Iraqi dinar.

§

IRR = 364

Iranian rial.

§

ISK = 352

Icelandic króna.

§

JMD = 388

Jamaican dollar.

§

JOD = 400

Jordanian dinar.

§

JPY = 392

Japanese yen.

§

KES = 404

Kenyan shilling.

§

KGS = 417

Kyrgyzstani som.

§

KHR = 116

Cambodian riel.

§

KMF = 174

Comoro franc.

§

KPW = 408

North Korean won.

§

KRW = 410

South Korean won.

§

KWD = 414

Kuwaiti dinar.

§

KYD = 136

Cayman Islands dollar.

§

KZT = 398

Kazakhstani tenge.

§

LAK = 418

Lao kip.

§

LBP = 422

Lebanese pound.

§

LKR = 144

Sri Lankan rupee.

§

LRD = 430

Liberian dollar.

§

LSL = 426

Lesotho loti.

§

LYD = 434

Libyan dinar.

§

MAD = 504

Moroccan dirham.

§

MDL = 498

Moldovan leu.

§

MGA = 969

Malagasy ariary.

§

MKD = 807

Macedonian denar.

§

MMK = 104

Myanmar kyat.

§

MNT = 496

Mongolian tögrög.

§

MOP = 446

Macanese pataca.

§

MRU = 929

Mauritanian ouguiya.

§

MUR = 480

Mauritian rupee.

§

MVR = 462

Maldivian rufiyaa.

§

MWK = 454

Malawian kwacha.

§

MXN = 484

Mexican peso.

§

MXV = 979

Mexican Unidad de Inversion (UDI).

§

MYR = 458

Malaysian ringgit.

§

MZN = 943

Mozambican metical.

§

NAD = 516

Namibian dollar.

§

NGN = 566

Nigerian naira.

§

NIO = 558

Nicaraguan córdoba.

§

NOK = 578

Norwegian krone.

§

NPR = 524

Nepalese rupee.

§

NZD = 554

New Zealand dollar.

§

OMR = 512

Omani rial.

§

PAB = 590

Panamanian balboa.

§

PEN = 604

Peruvian sol.

§

PGK = 598

Papua New Guinean kina.

§

PHP = 608

Philippine peso.

§

PKR = 586

Pakistani rupee.

§

PLN = 985

Polish złoty.

§

PYG = 600

Paraguayan guaraní.

§

QAR = 634

Qatari riyal.

§

RON = 946

Romanian leu.

§

RSD = 941

Serbian dinar.

§

RUB = 643

Russian ruble.

§

RWF = 646

Rwandan franc.

§

SAR = 682

Saudi riyal.

§

SBD = 90

Solomon Islands dollar.

§

SCR = 690

Seychelles rupee.

§

SDG = 938

Sudanese pound.

§

SEK = 752

Swedish krona.

§

SGD = 702

Singapore dollar.

§

SHP = 654

Saint Helena pound.

§

SLE = 925

Sierra Leonean leone (new leone).

§

SLL = 694

Sierra Leonean leone (old leone).

§

SOS = 706

Somali shilling.

§

SRD = 968

Surinamese dollar.

§

SSP = 728

South Sudanese pound.

§

STN = 930

São Tomé and Príncipe dobra.

§

SVC = 222

Salvadoran colón.

§

SYP = 760

Syrian pound.

§

SZL = 748

Swazi lilangeni.

§

THB = 764

Thai baht.

§

TJS = 972

Tajikistani somoni.

§

TMT = 934

Turkmenistan manat.

§

TND = 788

Tunisian dinar.

§

TOP = 776

Tongan paʻanga.

§

TRY = 949

Turkish lira.

§

TTD = 780

Trinidad and Tobago dollar.

§

TWD = 901

New Taiwan dollar.

§

TZS = 834

Tanzanian shilling.

§

UAH = 980

Ukrainian hryvnia.

§

UGX = 800

Ugandan shilling.

§

USD = 840

United States dollar.

§

USN = 997

United States dollar (next day).

§

UYI = 940

Uruguay Peso en Unidades Indexadas (URUIURUI).

§

UYU = 858

Uruguayan peso.

§

UYW = 927

Unidad previsional.

§

UZS = 860

Uzbekistan sum.

§

VED = 926

Venezuelan digital bolívar.

§

VES = 928

Venezuelan sovereign bolívar.

§

VND = 704

Vietnamese đồng.

§

VUV = 548

Vanuatu vatu.

§

WST = 882

Samoan tala.

§

XAF = 950

CFA franc BEAC.

§

XAG = 961

Silver (one troy ounce).

§

XAU = 959

Gold (one troy ounce).

§

XBA = 955

European Composite Unit (EURCO).

§

XBB = 956

European Monetary Unit (E.M.U.-6).

§

XBC = 957

European Unit of Account 9 (E.U.A.-9).

§

XBD = 958

European Unit of Account 17 (E.U.A.-17).

§

XCD = 951

East Caribbean dollar.

§

XDR = 960

Special drawing rights.

§

XOF = 952

CFA franc BCEAO.

§

XPD = 964

Palladium (one troy ounce).

§

XPF = 953

CFP franc (franc Pacifique).

§

XPT = 962

Platinum (one troy ounce).

§

XSU = 994

SUCRE.

§

XTS = 963

Code reserved for testing.

§

XUA = 965

ADB Unit of Account.

§

XXX = 999

No currency.

§

YER = 886

Yemeni rial.

§

ZAR = 710

South African rand.

§

ZMW = 967

Zambian kwacha.

§

ZWL = 932

Zimbabwean dollar (fifth).

Implementations§

Source§

impl CurrencyCode

Source

pub fn all() -> Vec<Self>

Returns all the currency codes.

Source

pub const fn currency(&self) -> Currency

Returns the Currency variant corresponding to the CurrencyCode.

This method provides an easy way to get to the associated Currency variant from a CurrencyCode enum variant.

Trait Implementations§

Source§

impl AsStr for CurrencyCode

Source§

fn as_str(&self) -> &'static str

Provides a string slice representation of the type.
Source§

impl Clone for CurrencyCode

Source§

fn clone(&self) -> CurrencyCode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CurrencyCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CurrencyCode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for CurrencyCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<CurrencyCode> for String

Source§

fn from(code: CurrencyCode) -> Self

Converts to this type from the input type.
Source§

impl From<CurrencyCode> for u16

Source§

fn from(code: CurrencyCode) -> Self

Converts to this type from the input type.
Source§

impl FromStr for CurrencyCode

Source§

type Err = String

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for CurrencyCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CurrencyCode

Source§

fn eq(&self, other: &CurrencyCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CurrencyCode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<String> for CurrencyCode

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(value: String) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<u16> for CurrencyCode

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(value: u16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for CurrencyCode

Source§

impl Eq for CurrencyCode

Source§

impl StructuralPartialEq for CurrencyCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,