pub struct MonetaryAmount {
pub units: u64,
pub currency: String,
}Expand description
A monetary amount with currency denomination.
Uses minor-unit integers to avoid floating-point precision issues. For USD, 1 dollar = 100 units (cents). For JPY, 1 yen = 1 unit.
Fields§
§units: u64Amount in the currency’s smallest unit (e.g. cents for USD).
currency: StringISO 4217 currency code. Examples: “USD”, “EUR”, “JPY”.
Trait Implementations§
Source§impl Clone for MonetaryAmount
impl Clone for MonetaryAmount
Source§fn clone(&self) -> MonetaryAmount
fn clone(&self) -> MonetaryAmount
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 MonetaryAmount
impl Debug for MonetaryAmount
Source§impl<'de> Deserialize<'de> for MonetaryAmount
impl<'de> Deserialize<'de> for MonetaryAmount
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MonetaryAmount, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MonetaryAmount, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for MonetaryAmount
impl PartialEq for MonetaryAmount
Source§impl Serialize for MonetaryAmount
impl Serialize for MonetaryAmount
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for MonetaryAmount
impl StructuralPartialEq for MonetaryAmount
Auto Trait Implementations§
impl Freeze for MonetaryAmount
impl RefUnwindSafe for MonetaryAmount
impl Send for MonetaryAmount
impl Sync for MonetaryAmount
impl Unpin for MonetaryAmount
impl UnsafeUnpin for MonetaryAmount
impl UnwindSafe for MonetaryAmount
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