1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*!
This package contains an implementation of the
[ISO 4217](https://www.iso.org/iso-4217-currency-codes.html)
Currency Codes specification.
This standard establishes internationally recognized codes for the
representation of currencies that enable clarity and reduce errors. Currencies
are represented both numerically and alphabetically, using either three digits
or three letters. Some of the alphabetic codes for major currencies are
familiar, such as "EUR" for Euros. Fortunately, ISO 4217 covers everything
from Afghanis to Zambian Kwacha as well.
This package extends the data model of the ISO specification by adding a
currency symbol string (and Unicode code points for the symbol) where possible
to all symbols.
# Example
```rust
use codes_iso_4217::{CurrencyCode, ISO_4217};
let code = CurrencyCode::BZD;
assert_eq!(code.alpha_code(), "BZD");
assert_eq!(code.numeric_code(), Some(84));
// feature = "currency_name"
// assert_eq!(code.currency_name(), "Belize Dollar");
// feature = "country_name"
// assert_eq!(code.country_name(), "BELIZE");
// feature = "monetary_units"
// assert_eq!(code.monetary_units(), 2);
// feature = "is_fund"
// assert_eq!(code.is_fund(), false);
// feature = "historical_codes"
// assert_eq!(code.is_historical(), false);
// assert_eq!(code.withdrawal_date(), None);
// feature = "symbols"
// assert_eq!(code.currency_symbol_str(), Some("BZ$"));
// assert_eq!(code.currency_symbol_code_points(), Some(&[0x42, 0x5a, 0x24]));
assert_eq!(ISO_4217.title(), "Currency codes");
```
# Features
By default only the `serde` feature is enabled, the [CurrencyCode::alpha_code] and
[CurrencyCode::numeric_code] methods cannot be excluded.
* `serde` - Enables serialization of the [CurrencyCode] type.
* `currency_name` - Adds the [CurrencyCode::currency_name] method.
* `country_name` - Adds the [CurrencyCode::country_name] method.
* `monetary_units` - Adds the [CurrencyCode::monetary_units] method.
* `is_fund` - Adds the [CurrencyCode::is_fund] method.
* `historical_codes` - Adds the [CurrencyCode::is_historical] and [CurrencyCode::withdrawal_date] methods.
* `symbols` - Adds the [CurrencyCode::currency_symbol_str] and [CurrencyCode::currency_symbol_code_points] methods.
*/
// ------------------------------------------------------------------------------------------------
//
// The rest of this file is generated by the package build script.
//
// ------------------------------------------------------------------------------------------------
include!;