pub enum DecimalError {
CoefficientOutOfRange {
spec: DecimalSpec,
},
ArithmeticOverflow,
SpecMismatch {
left: DecimalSpec,
right: DecimalSpec,
},
LossyRescale {
from_scale: u8,
to_scale: u8,
},
}Expand description
A safe decimal construction or arithmetic failure.
Variants§
CoefficientOutOfRange
The coefficient does not fit the declared precision.
Fields
§
spec: DecimalSpecThe decimal type whose precision was exceeded.
ArithmeticOverflow
An i128 arithmetic operation overflowed.
SpecMismatch
An operation combined distinct decimal types.
LossyRescale
Reducing scale would discard nonzero decimal digits.
Trait Implementations§
Source§impl Clone for DecimalError
impl Clone for DecimalError
impl Copy for DecimalError
Source§impl Debug for DecimalError
impl Debug for DecimalError
Source§impl Display for DecimalError
impl Display for DecimalError
impl Eq for DecimalError
Source§impl Error for DecimalError
impl Error for DecimalError
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<DecimalError> for MoneyError
impl From<DecimalError> for MoneyError
Source§fn from(error: DecimalError) -> Self
fn from(error: DecimalError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DecimalError
impl PartialEq for DecimalError
impl StructuralPartialEq for DecimalError
Auto Trait Implementations§
impl Freeze for DecimalError
impl RefUnwindSafe for DecimalError
impl Send for DecimalError
impl Sync for DecimalError
impl Unpin for DecimalError
impl UnsafeUnpin for DecimalError
impl UnwindSafe for DecimalError
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