pub struct Financial(pub FinancialBase);Expand description
Financial numbers designed to prevent falsification.
use chinese_format::*;
let two = Financial(2);
assert_eq!(two.to_chinese(Variant::Simplified), Chinese {
logograms: "贰".to_string(),
omissible: false
});
assert_eq!(two.to_chinese(Variant::Traditional), Chinese {
logograms: "貳".to_string(),
omissible: false
});Tuple Fields§
§0: FinancialBaseTrait Implementations§
Source§impl ChineseFormat for Financial
impl ChineseFormat for Financial
use chinese_format::*;
let ten = Financial(10);
assert_eq!(ten.to_chinese(Variant::Simplified), Chinese {
logograms: "拾".to_string(),
omissible: false
});
assert_eq!(ten.to_chinese(Variant::Traditional), Chinese {
logograms: "拾".to_string(),
omissible: false
});
let one_thousand = Financial(1000);
assert_eq!(one_thousand.to_chinese(Variant::Simplified), "壹仟");
assert_eq!(one_thousand.to_chinese(Variant::Traditional), "壹仟");
let zero = Financial(0);
assert_eq!(zero.to_chinese(Variant::Simplified), Chinese {
logograms: "零".to_string(),
omissible: true
});
assert_eq!(zero.to_chinese(Variant::Traditional), Chinese {
logograms: "零".to_string(),
omissible: true
});
let max = Financial(FinancialBase::MAX);
assert_eq!(max.to_chinese(Variant::Simplified), Chinese {
logograms: "壹仟捌佰肆拾肆京陆仟柒佰肆拾肆兆零柒佰叁拾柒亿零玖佰伍拾伍万壹仟陆佰壹拾伍".to_string(),
omissible: false
});
assert_eq!(max.to_chinese(Variant::Traditional), Chinese {
logograms: "壹仟捌佰肆拾肆京陸仟柒佰肆拾肆兆零柒佰參拾柒億零玖佰伍拾伍萬壹仟陸佰壹拾伍".to_string(),
omissible: false
});fn to_chinese(&self, variant: Variant) -> Chinese
Source§impl Ord for Financial
impl Ord for Financial
Source§impl PartialEq<u64> for Financial
Financial supports equality with the underlying integer.
impl PartialEq<u64> for Financial
Financial supports equality with the underlying integer.
use chinese_format::*;
assert_eq!(Financial(90), 90);
assert_ne!(Financial(90), 83);Source§impl PartialOrd<u64> for Financial
Financial supports comparisons with the underlying integer.
impl PartialOrd<u64> for Financial
Financial supports comparisons with the underlying integer.
use chinese_format::*;
assert!(Financial(90) < 100);
assert!(Financial(90) > 5);
assert!(Financial(90) >= 90);Source§impl PartialOrd for Financial
impl PartialOrd for Financial
impl Copy for Financial
impl Eq for Financial
impl StructuralPartialEq for Financial
Auto Trait Implementations§
impl Freeze for Financial
impl RefUnwindSafe for Financial
impl Send for Financial
impl Sync for Financial
impl Unpin for Financial
impl UnwindSafe for Financial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more