pub struct Amount(/* private fields */);Expand description
Monetary amount. Never f64. Scale is two decimals unless noted (BR-DEC).
Implementations§
Source§impl Amount
impl Amount
pub const ZERO: Self
pub fn new(value: Decimal) -> Self
pub fn from_minor(cents: i64) -> Self
pub fn parse(s: &str) -> Result<Self, Error>
pub fn raw(self) -> Decimal
pub fn is_zero(self) -> bool
pub fn saturating_add(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Trait Implementations§
impl Copy for Amount
impl Eq for Amount
Source§impl Ord for Amount
impl Ord for Amount
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 Amount
impl PartialOrd for Amount
impl StructuralPartialEq for Amount
Auto Trait Implementations§
impl Freeze for Amount
impl RefUnwindSafe for Amount
impl Send for Amount
impl Sync for Amount
impl Unpin for Amount
impl UnsafeUnpin for Amount
impl UnwindSafe for Amount
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