pub enum ArithmeticError {
Overflow,
Underflow,
DivisionByZero,
ScaleExceeded,
InvalidInput,
}Expand description
All errors that can arise from fixed-point arithmetic in fermat-core.
Every fallible operation returns Result<_, ArithmeticError> instead of
panicking, satisfying the sBPF requirement for panic-free on-chain programs.
Variants§
Overflow
The result exceeded the representable range of i128.
Underflow
The result fell below the representable range of i128.
DivisionByZero
A division or modulo operation was attempted with a zero denominator.
ScaleExceeded
A scale value exceeded MAX_SCALE (28) was provided or computed.
InvalidInput
The input could not be parsed or is otherwise malformed (e.g. bad string).
Trait Implementations§
Source§impl Clone for ArithmeticError
impl Clone for ArithmeticError
Source§fn clone(&self) -> ArithmeticError
fn clone(&self) -> ArithmeticError
Returns a duplicate of the value. Read more
1.0.0 · 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 ArithmeticError
impl Debug for ArithmeticError
Source§impl Display for ArithmeticError
impl Display for ArithmeticError
Source§impl Hash for ArithmeticError
impl Hash for ArithmeticError
Source§impl PartialEq for ArithmeticError
impl PartialEq for ArithmeticError
impl Copy for ArithmeticError
impl Eq for ArithmeticError
impl StructuralPartialEq for ArithmeticError
Auto Trait Implementations§
impl Freeze for ArithmeticError
impl RefUnwindSafe for ArithmeticError
impl Send for ArithmeticError
impl Sync for ArithmeticError
impl Unpin for ArithmeticError
impl UnsafeUnpin 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