sifton / isocountry-rs Goto Github PK
View Code? Open in Web Editor NEWISO-3166-1 Country Codes for Rust
License: MIT License
ISO-3166-1 Country Codes for Rust
License: MIT License
This test:
fn foo() {
let raw = "USA";
let cc = CountryCode::for_alpha3_caseless(raw).unwrap();
assert_eq!(CountryCode::USA, cc);
}
fails:
failures:
---- country_code::test::foo stdout ----
thread 'country_code::test::foo' panicked at 'assertion failed: `(left == right)`
left: `USA`,
right: `AFG`', src/country_code.rs:48:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Running the same test with alpha2
and US
works as expected:
#[test]
fn foo2() {
let raw = "US";
let cc = CountryCode::for_alpha2_caseless(raw).unwrap();
assert_eq!(CountryCode::USA, cc);
}
Hello!
Since the enum variants use alpha-3, I think it might make sense to use them in the ser/de implementation (by default), but failing that, at least have a feature to switch to alpha-3 for ser/de impls. What do you think?
I would be happy to submit a PR for it if you think it would be a good idea.
Currently the error message for an incorrect country says expected expecting an ISO 3166-1 ...
because the expecting
function's message begins with expecting
instead of just the thing it was expecting.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.