| Crates.io | gb2260 |
| lib.rs | gb2260 |
| version | 0.1.2 |
| created_at | 2018-04-13 14:34:22.081371+00 |
| updated_at | 2020-03-08 13:56:34.060706+00 |
| description | The Rust implementation for looking up Chinese administrative divisions |
| homepage | |
| repository | https://github.com/cn/GB2260.rs |
| max_upload_size | |
| id | 60426 |
| size | 2,515,547 |
The Rust implementation for looking up Chinese administrative divisions.
Add it to your Cargo.toml:
[dependencies]
gb2260 = "0.1"
Add extern crate gb2260 to your crate root and your're good to go!
extern crate gb2260;
use gb2260::Division;
fn main() {
let division = Division::get("110000").unwrap();
assert_eq!(division.code, "110000");
assert_eq!(division.name, "北京市");
assert!(division.is_province());
assert!(!division.is_prefecture());
assert!(!division.is_county());
}
This work is released under the MIT license. A copy of the license is provided in the LICENSE file.