Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust_iso3166"
version = "0.1.14"
version = "0.1.15"
edition = "2021"
description="ISO 3166-1 (Codes for the representation of names of countries and their subdivisions – Part 1: Country codes) is a standard defining codes for the names of countries, dependent territories, and special areas of geographical interest. It is the first part of the ISO 3166 standard published by the International Organization for Standardization."
repository="https://github.com/rust-iso/rust_iso3166"
Expand All @@ -14,7 +14,7 @@ keywords=["ISO3166", "ISO3166-1", "ISO3166-2", "ISO3166-3"]
crate-type = ["cdylib", "rlib"]

[dependencies]
phf = { version = "^0.11.1", features = ["macros"] }
phf = { version = "0.12.1", features = ["macros"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
prettytable-rs = "^0.10"
Expand Down
36 changes: 27 additions & 9 deletions scripts/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,25 @@

print(
"""
///CountryCode map with alpha2 Code key
///CountryCode map with name key
pub const NAME_MAP: Map<&str, CountryCode> = phf_map! {
"""
)
for x in a.split("\n"):
ts = x.split("\t")
if len(ts) < 2:
print(x)
continue
print('"%s" => %s,' % (ts[0], ts[1]))
print(
"""
};
"""
)

print(
"""
///CountryCode map with alpha2 Code key
pub const ALPHA2_MAP: Map<&str, CountryCode> = phf_map! {
"""
)
Expand All @@ -458,7 +476,7 @@

print(
"""
///CountryCode map with alpha3 Code key
///CountryCode map with alpha3 Code key
pub const ALPHA3_MAP: Map<&str, CountryCode> = phf_map! {
"""
)
Expand All @@ -476,7 +494,7 @@

print(
"""
///CountryCode map with 3 len numeric str Code key
///CountryCode map with 3 len numeric str Code key
pub const NUMERIC_MAP: Map<&str, CountryCode> = phf_map! {
"""
)
Expand All @@ -494,7 +512,7 @@

print(
"""
///ALL the names of Countrys
///ALL the names of Countries
pub const ALL_NAME: & [&str] = &[
"""
)
Expand All @@ -512,7 +530,7 @@

print(
"""
///ALL the alpha2 codes of Countrys
///ALL the alpha2 codes of Countries
pub const ALL_ALPHA2: & [&str] = &[
"""
)
Expand All @@ -529,7 +547,7 @@
)
print(
"""
///ALL the alpha3 codes of Countrys
///ALL the alpha3 codes of Countries
pub const ALL_ALPHA3: & [&str] = &[
"""
)
Expand All @@ -547,7 +565,7 @@

print(
"""
///ALL the 3 length numeric str codes of Countrys
///ALL the 3 length numeric str codes of Countries
pub const ALL_NUMERIC_STR: & [&str] = &[
"""
)
Expand All @@ -565,7 +583,7 @@

print(
"""
///ALL the numeric codes of Countrys
///ALL the numeric codes of Countries
pub const ALL_NUMERIC: & [i32] = &[
"""
)
Expand All @@ -583,7 +601,7 @@

print(
"""
///ALL the Countrys struct
///ALL the Countries struct
pub const ALL: & [CountryCode] = &[
"""
)
Expand Down
Loading