pub struct Money {
pub unit: String,
pub value: Decimal,
}
Expand description
Money sub-resource
Fields§
§unit: String
ISO4217 currency code
value: Decimal
Value
Implementations§
Source§impl Money
impl Money
Sourcepub fn currency(&mut self, currency_code: &str) -> Result<String, TMFError>
pub fn currency(&mut self, currency_code: &str) -> Result<String, TMFError>
Set currency for this Money with an optional currency_code. This code must confirm to ISO4217. If an invalid code is passed in, an Err is returned instead.
use tmflib::common::money::Money;
use rust_decimal::Decimal;
let mut money = Money::from(100);
money.currency("AUD");
Trait Implementations§
Source§impl AddAssign for Money
impl AddAssign for Money
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl<'de> Deserialize<'de> for Money
impl<'de> Deserialize<'de> for Money
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Money
Auto Trait Implementations§
impl Freeze for Money
impl RefUnwindSafe for Money
impl Send for Money
impl Sync for Money
impl Unpin for Money
impl UnwindSafe for Money
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