Crate jp_prefecture

Crate jp_prefecture 

Source
Expand description

§Overview

jp-prefecture is an utility library for handling Japanese prefectures.

§Getting Started

Crate has to be added as dependency to Cargo.toml

[dependencies]
jp-prefecture = "3.1.0"

and imported to the scope of a block where it’s begin called

use jp_prefecture::prefectures;

§Examples

use jp_prefecture::prefectures;

let tokyo = prefectures::find_by_kanji("東京都");
println!("{:?}", tokyo); // => Ok(Prefecture::Tokyo)
println!("{:?}", tokyo.as_ref().unwrap().kanji()); // => "東京都"
println!("{:?}", tokyo.as_ref().unwrap().kanji_short()); // => "東京"
println!("{:?}", tokyo.as_ref().unwrap().english()); // => "Tokyo"

let tokyo = prefectures::find_by_kanji("東京県"); // uhmmmm...
println!("{:?}", tokyo); // => Err(Error::InvalidPrefectureName("東京県"))

Modules§

prefectures
japanese prefectures

Enums§

Error
Enum representing errors related to Japanese prefectures