chinese_format/length.rs
1//! Length measures.
2//!
3//! ```
4//! use chinese_format::{*, length::*};
5//!
6//! let two_km = Kilometer::new(2);
7//!
8//! assert_eq!(
9//! two_km.to_chinese(Variant::Simplified),
10//! Chinese {
11//! logograms: "两公里".to_string(),
12//! omissible: false
13//! }
14//! );
15//!
16//! assert_eq!(
17//! two_km.to_chinese(Variant::Traditional),
18//! Chinese {
19//! logograms: "兩公里".to_string(),
20//! omissible: false
21//! }
22//! );
23//!
24//!
25//! let two_cm = Centimeter::new(2);
26//!
27//! assert_eq!(
28//! two_cm.to_chinese(Variant::Simplified),
29//! Chinese {
30//! logograms: "两厘米".to_string(),
31//! omissible: false
32//! }
33//! );
34//!
35//! assert_eq!(
36//! two_cm.to_chinese(Variant::Traditional),
37//! Chinese {
38//! logograms: "兩釐米".to_string(),
39//! omissible: false
40//! }
41//! );
42//!
43//!
44//! let zero_m = Meter::new(0);
45//!
46//! assert_eq!(
47//! zero_m.to_chinese(Variant::Simplified),
48//! Chinese {
49//! logograms: "零米".to_string(),
50//! omissible: true
51//! }
52//! );
53//!
54//! assert_eq!(
55//! zero_m.to_chinese(Variant::Traditional),
56//! Chinese {
57//! logograms: "零米".to_string(),
58//! omissible: true
59//! }
60//! );
61//! ```
62use crate::define_count_measure;
63
64define_count_measure!(pub, Kilometer, "公里");
65
66define_count_measure!(pub, HalfKilometer, "里");
67
68define_count_measure!(pub, Meter, "米");
69
70define_count_measure!(pub, Decimeter, "分米");
71
72define_count_measure!(pub, Centimeter, ("厘米", "釐米"));
73
74define_count_measure!(pub, Millimeter, "毫米");