pub enum MoneyError {
NotDecimal(String),
TooPrecise {
value: String,
currency: Currency,
exponent: u32,
},
Overflow(String),
NotPositive(i64),
CurrencyMismatch {
left: Currency,
right: Currency,
},
}Expand description
A decimal string could not be read as an amount in the given currency.
Variants§
NotDecimal(String)
The text was not a plain decimal number.
TooPrecise
The text carried more decimal places than the currency has.
Fields
Overflow(String)
The amount did not fit in an i64 of minor units.
NotPositive(i64)
The amount was zero or negative where a positive one was required.
CurrencyMismatch
Two amounts in different currencies were combined.
Trait Implementations§
Source§impl Clone for MoneyError
impl Clone for MoneyError
Source§fn clone(&self) -> MoneyError
fn clone(&self) -> MoneyError
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 moreSource§impl Debug for MoneyError
impl Debug for MoneyError
Source§impl Display for MoneyError
impl Display for MoneyError
impl Eq for MoneyError
Source§impl Error for MoneyError
impl Error for MoneyError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<MoneyError> for ChargeRequestError
impl From<MoneyError> for ChargeRequestError
Source§fn from(source: MoneyError) -> Self
fn from(source: MoneyError) -> Self
Converts to this type from the input type.
Source§impl From<MoneyError> for RefundRequestError
impl From<MoneyError> for RefundRequestError
Source§fn from(source: MoneyError) -> Self
fn from(source: MoneyError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for MoneyError
impl PartialEq for MoneyError
impl StructuralPartialEq for MoneyError
Auto Trait Implementations§
impl Freeze for MoneyError
impl RefUnwindSafe for MoneyError
impl Send for MoneyError
impl Sync for MoneyError
impl Unpin for MoneyError
impl UnsafeUnpin for MoneyError
impl UnwindSafe for MoneyError
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