Package codes-iso-3166

This package contains an implementation of the ISO 3166 part 1 standard.

The purpose of ISO 3166 is to define internationally recognized codes of letters and/or numbers that we can use when we refer to countries and their subdivisions. However, it does not define the names of countries – this information comes from United Nations sources (Terminology Bulletin Country Names and the Country and Region Codes for Statistical Use maintained by the United Nations Statistics Divisions).

The country codes can be represented either as a two-letter code (alpha-2) which is recommended as the general-purpose code, a three-letter code (alpha-3) which is more closely related to the country name and a three-digit numeric code (numeric-3) which can be useful if you need to avoid using Latin script.

This package does not include an implementation of part-3, Code for formerly used names of countries.

For notes on the design of the API, see the repository README.

Example

This example shows the use of the part-1 Country Code.

```rust use codesiso3166::part_1::CountryCode;

let country = CountryCode::from_str("AG").unwrap();

asserteq!(country.alpha2code(), "AG"); asserteq!(country.short_name(), "Antigua and Barbuda"); ```

Features

By default only the serde feature is enabled, and [part_1] two-letter language codes.

Note that the method CountryCode::local_full_name requires both local_names and full_name features.

Refresh

While ISO licenses the 3166 tables freely, access to the whole data tables is via subscription, and so there is not currently a way to download the tables periodically to keep up-to-date.

Changes

Version 0.1.2

Version 0.1.1

Version 0.1.0

TODO

  1. Add local_name to subdivision categories using administrative language.
  2. Build true indices for secondary code lookups.