pub struct Money { /* private fields */ }Implementations§
Trait Implementations§
Source§impl AddAssign for Money
Money += Money
impl AddAssign for Money
Money += Money
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl BaseMoney for Money
impl BaseMoney for Money
Source§fn round(self) -> Self
fn round(self) -> Self
Round money using Currency’s rounding strategy to the scale of currency’s minor unit
Source§fn numeric_code(&self) -> i32
fn numeric_code(&self) -> i32
Get currency ISO 4217 numeric code
Source§fn minor_unit(&self) -> u16
fn minor_unit(&self) -> u16
Get money minor unit
Source§fn minor_amount(&self) -> MoneyResult<i128>
fn minor_amount(&self) -> MoneyResult<i128>
Get money amount in its smallest unit
Source§fn thousand_separator(&self) -> &'static str
fn thousand_separator(&self) -> &'static str
Get money thousands separator
Source§fn decimal_separator(&self) -> &'static str
fn decimal_separator(&self) -> &'static str
Get money decimal separator
Source§fn is_positive(&self) -> bool
fn is_positive(&self) -> bool
Check if sign is +
Source§fn is_negative(&self) -> bool
fn is_negative(&self) -> bool
Check if sign is -
Source§fn format_code(&self) -> String
fn format_code(&self) -> String
Format money with code along with thousands and decimal separators.
Example: USD 1,234.45
Source§fn format_symbol(&self) -> String
fn format_symbol(&self) -> String
Format money with symbol along with thousands and decimal separators.
Example: $1,234.45
Source§fn format_code_minor(&self) -> MoneyResult<String>
fn format_code_minor(&self) -> MoneyResult<String>
Format money with code in the smallest unit along with thousands separators.
Example USD 1,234.45 –> USD 123,445 ¢
If the currency has no minor unit symbol, it defaults to “minor”.
You can set the minor unit symbol in
Currency type’s setter.Source§fn format_symbol_minor(&self) -> MoneyResult<String>
fn format_symbol_minor(&self) -> MoneyResult<String>
Format money with code in the smallest unit along with thousands separators.
Example $1,234.45 –> $123,445 ¢
If the currency has no minor unit symbol, it defaults to “minor”.
You can set the minor unit symbol in
Currency type’s setter.Source§impl BaseOps for Money
impl BaseOps for Money
Source§fn clamp(&self, from: Decimal, to: Decimal) -> Self
fn clamp(&self, from: Decimal, to: Decimal) -> Self
clamp the money amount between from and to inclusively.
fn min(&self, rhs: Self) -> Self
fn max(&self, rhs: Self) -> Self
fn add(&self, rhs: Decimal) -> MoneyResult<Self>
fn sub(&self, rhs: Decimal) -> MoneyResult<Self>
fn mul(&self, rhs: Decimal) -> MoneyResult<Self>
fn div(&self, rhs: Decimal) -> MoneyResult<Self>
Source§impl CustomMoney for Money
impl CustomMoney for Money
fn set_thousand_separator(&mut self, separator: &'static str)
fn set_decimal_separator(&mut self, separator: &'static str)
fn round_with(self, decimal_points: u32, strategy: RoundingStrategy) -> Self
Source§impl DivAssign for Money
Money /= Money
impl DivAssign for Money
Money /= Money
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the
/= operation. Read moreSource§impl MulAssign for Money
Money *= Money
impl MulAssign for Money
Money *= Money
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*= operation. Read moreSource§impl PartialOrd for Money
impl PartialOrd for Money
Source§impl SubAssign for Money
Money -= Money
impl SubAssign for Money
Money -= Money
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreimpl Copy for Money
impl Eq 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