pub struct BahtAmount {
pub baht: u64,
pub satang: u8,
}Expand description
A monetary amount in Thai Baht.
satang is the sub-unit (1 baht = 100 satang). Valid range is 0–99.
§Examples
use kham_core::number::{BahtAmount, parse_thai_baht, to_thai_baht_text};
let amt = parse_thai_baht("หนึ่งร้อยยี่สิบสามบาทห้าสิบสตางค์").unwrap();
assert_eq!(amt.baht, 123);
assert_eq!(amt.satang, 50);
assert_eq!(to_thai_baht_text(123, 50), "หนึ่งร้อยยี่สิบสามบาทห้าสิบสตางค์");
assert_eq!(to_thai_baht_text(100, 0), "หนึ่งร้อยบาทถ้วน");Fields§
§baht: u64Whole baht.
satang: u8Satang (0–99). 100 satang = 1 baht.
Trait Implementations§
Source§impl Clone for BahtAmount
impl Clone for BahtAmount
Source§fn clone(&self) -> BahtAmount
fn clone(&self) -> BahtAmount
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BahtAmount
impl Debug for BahtAmount
Source§impl PartialEq for BahtAmount
impl PartialEq for BahtAmount
impl Copy for BahtAmount
impl Eq for BahtAmount
impl StructuralPartialEq for BahtAmount
Auto Trait Implementations§
impl Freeze for BahtAmount
impl RefUnwindSafe for BahtAmount
impl Send for BahtAmount
impl Sync for BahtAmount
impl Unpin for BahtAmount
impl UnsafeUnpin for BahtAmount
impl UnwindSafe for BahtAmount
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