Package codes-un-m49

This package contains an implementation of the UN M49 specification.

crates.io docs.rs

UN M49 or the Standard Country or Area Codes for Statistical Use (Series M, No. 49) is a standard for area codes used by the United Nations for statistical purposes, developed and maintained by the United Nations Statistics Division. Each area code is a 3-digit number which can refer to a wide variety of geographical and political regions, like a continent and a country. Codes assigned in the system generally do not change when the country or area's name changes (unlike ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3), but instead change when the territorial extent of the country or area changes significantly, although there have been exceptions to this rule.

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

Example

```rust use codesunm49 as M49;

let region = M49::UNM69REGION_258;

asserteq!(region.code(), 258); asserteq!(region.name(), "French Polynesia"); asserteq!(region.kind(), M49::RegionKind::Country); asserteq!(region.country_code(), Some("PF"));

// feature = "countrycodes" asserteq!(parent.country_code(), Some(CountryCode::PF));

let parent = region.parentcode().unwrap(); asserteq!(parent.code(), 61); assert_eq!(parent.name(), "Polynesia");

let parent = parent.parentcode().unwrap(); asserteq!(parent.code(), 9); assert_eq!(parent.name(), "Oceania");

let parent = parent.parentcode().unwrap(); asserteq!(parent.code(), 1); assert_eq!(parent.name(), "World"); ```

Features

By default only the serde feature is enabled.

Changes

Version 0.1.0

TODO

TBD