Crates.io | iso4217 |
lib.rs | iso4217 |
version | 0.3.2 |
source | src |
created_at | 2016-01-11 21:28:42.309914 |
updated_at | 2018-07-22 05:21:56.835519 |
description | ISO 4217 data. |
homepage | |
repository | https://github.com/zeyla/iso4217.rs |
max_upload_size | |
id | 3875 |
size | 38,548 |
Rust crate for ISO 4217 data.
ISO 4217 is a standard published by the International Organization for Standardization, which delineates currency designators, country codes (alpha and numeric), and references to minor units in three tables.
-- Wikipedia
Add the following dependency to your Cargo.toml:
iso4217 = "0.3"
And include it in your project:
extern crate iso4217;
Retrieve all currencies defined by ISO 4217:
extern crate iso4217;
fn main() {
let currencies = iso4217::all().unwrap();
}
Retrieve a currency by its alpha3 code:
extern crate iso4217;
fn main() {
let currency = iso4217::alpha3("EUR").unwrap();
}
Retrieve a vector of currencies used by a country, given an alpha2 code specified by ISO 3166:
extern crate iso4217;
fn main() {
let currencies = iso4217::country("SG").unwrap();
}
Retrieve a vector of currencies with a certain exponential value (decimal places):
extern crate iso4217;
fn main() {
let currencies = iso4217::exp(2).unwrap();
}
Retrieve by the full name of the currency:
extern crate iso4217;
fn main() {
let currency = iso4217::name("Turkish lira").unwrap();
}
Retrieve by the 3-digit numeric representation of the currency:
extern crate iso4217;
fn main() {
let currency = iso4217::num("840").unwrap();
}
License info in LICENSE.md. Long story short, ISC.