chinese_format/weight.rs
1//! Weight measures.
2//!
3//! [HalfKilogram] seems especially used in Chinese, although [Kilogram] is available as well.
4//!
5//! ```
6//! use chinese_format::{*, weight::*};
7//!
8//! let two_kg = Kilogram::new(2);
9//!
10//! assert_eq!(
11//! two_kg.to_chinese(Variant::Simplified),
12//! Chinese {
13//! logograms: "两公斤".to_string(),
14//! omissible: false
15//! }
16//! );
17//!
18//! assert_eq!(
19//! two_kg.to_chinese(Variant::Traditional),
20//! Chinese {
21//! logograms: "兩公斤".to_string(),
22//! omissible: false
23//! }
24//! );
25//!
26//!
27//! let zero_hkg = HalfKilogram::new(0);
28//!
29//! assert_eq!(
30//! zero_hkg.to_chinese(Variant::Simplified),
31//! Chinese {
32//! logograms: "零斤".to_string(),
33//! omissible: true
34//! }
35//! );
36//!
37//! assert_eq!(
38//! zero_hkg.to_chinese(Variant::Traditional),
39//! Chinese {
40//! logograms: "零斤".to_string(),
41//! omissible: true
42//! }
43//! );
44//! ```
45use crate::define_count_measure;
46
47define_count_measure!(pub, HalfKilogram, "斤");
48
49define_count_measure!(pub, Kilogram, "公斤");