pub struct Money(pub i64);Expand description
An amount in minor units (1/100 of a peso).
Tuple Fields§
§0: i64Implementations§
Source§impl Money
impl Money
pub const ZERO: Money
pub fn minor(self) -> i64
Sourcepub fn as_major_f64(self) -> f64
pub fn as_major_f64(self) -> f64
Major units as an f64 (for JSON total_php-style output). Lossy for
huge values but fine for prices.
Sourcepub fn trimmed_major(self) -> String
pub fn trimmed_major(self) -> String
Major-unit number with up to 2 decimals and no trailing zeros
(440, 909.5, 1003.25) for vault notes.
Trait Implementations§
impl Copy for Money
Source§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 Eq for Money
Source§impl Ord for Money
impl Ord for Money
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Money
impl PartialOrd for Money
impl StructuralPartialEq for Money
Auto Trait Implementations§
impl Forget for Money
impl Freeze for Money
impl RefUnwindSafe for Money
impl Send for Money
impl Sync for Money
impl Unpin for Money
impl UnsafeUnpin 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