pub struct InvoiceAmount(/* private fields */);Expand description
EN 16931 Amount.Type: at most two fraction digits. Never f64. Never rounds.
Implementations§
Source§impl InvoiceAmount
impl InvoiceAmount
pub const ZERO: Self
pub fn from_minor(cents: i64) -> Self
pub fn try_new(value: Decimal) -> Result<Self, AmountError>
pub fn parse(s: &str) -> Result<Self, AmountError>
pub fn raw(self) -> Decimal
pub fn is_zero(self) -> bool
pub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
pub fn abs(self) -> Self
pub fn checked_sum(amounts: impl IntoIterator<Item = Self>) -> Option<Self>
Sourcepub fn from_decimal_rounded(value: Decimal) -> Result<Self, AmountError>
pub fn from_decimal_rounded(value: Decimal) -> Result<Self, AmountError>
Commercial rounding (half away from zero) to two decimals — producer
presentation. Validators use crate::arith::xpath_round.
Trait Implementations§
Source§impl Clone for InvoiceAmount
impl Clone for InvoiceAmount
Source§fn clone(&self) -> InvoiceAmount
fn clone(&self) -> InvoiceAmount
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for InvoiceAmount
Source§impl Debug for InvoiceAmount
impl Debug for InvoiceAmount
Source§impl Display for InvoiceAmount
impl Display for InvoiceAmount
impl Eq for InvoiceAmount
Source§impl FromStr for InvoiceAmount
impl FromStr for InvoiceAmount
Source§impl Hash for InvoiceAmount
impl Hash for InvoiceAmount
Source§impl Ord for InvoiceAmount
impl Ord for InvoiceAmount
Source§fn cmp(&self, other: &InvoiceAmount) -> Ordering
fn cmp(&self, other: &InvoiceAmount) -> Ordering
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 PartialEq for InvoiceAmount
impl PartialEq for InvoiceAmount
Source§impl PartialOrd for InvoiceAmount
impl PartialOrd for InvoiceAmount
impl StructuralPartialEq for InvoiceAmount
Auto Trait Implementations§
impl Freeze for InvoiceAmount
impl RefUnwindSafe for InvoiceAmount
impl Send for InvoiceAmount
impl Sync for InvoiceAmount
impl Unpin for InvoiceAmount
impl UnsafeUnpin for InvoiceAmount
impl UnwindSafe for InvoiceAmount
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