Enum arithmetic_eval::error::ArithmeticError
source · #[non_exhaustive]pub enum ArithmeticError {
IntegerOverflow,
DivisionByZero,
InvalidExponent,
NoInverse,
InvalidOp(Error),
}Expand description
Arithmetic errors raised by Arithmetic operations on primitive values.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
IntegerOverflow
Integer overflow or underflow.
DivisionByZero
Division by zero.
InvalidExponent
Exponent of Arithmetic::pow() cannot be converted to usize, for example because
it is too large or negative.
NoInverse
Integer used as a denominator in Arithmetic::div() has no multiplicative inverse.
InvalidOp(Error)
Invalid operation with a custom error message.
This error may be used by Arithmetic implementations
as a catch-all fallback.
Implementations§
source§impl ArithmeticError
impl ArithmeticError
sourcepub fn invalid_op(message: impl Into<String>) -> Self
pub fn invalid_op(message: impl Into<String>) -> Self
Creates a new invalid operation error with the specified message.
Trait Implementations§
source§impl Debug for ArithmeticError
impl Debug for ArithmeticError
source§impl Display for ArithmeticError
impl Display for ArithmeticError
source§impl Error for ArithmeticError
impl Error for ArithmeticError
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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()
Auto Trait Implementations§
impl Freeze for ArithmeticError
impl RefUnwindSafe for ArithmeticError
impl Send for ArithmeticError
impl Sync for ArithmeticError
impl Unpin for ArithmeticError
impl UnwindSafe for ArithmeticError
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