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