pub enum SafeMathError {
Overflow = 9_000,
Underflow = 9_001,
ConversionFailed = 9_002,
}Expand description
Errors returned by safe arithmetic operations and numeric conversions.
Errors are numbered from the range 9000 - 9999 when used in conversions to custom program errors.
Variants§
Overflow = 9_000
Arithmetic operation exceeded the maximum numeric bound of the target type.
Underflow = 9_001
Arithmetic operation went below the minimum numeric bound of the target type.
ConversionFailed = 9_002
Integer could not be safely cast to the target numeric type.
Trait Implementations§
Source§impl Debug for SafeMathError
impl Debug for SafeMathError
Source§impl Display for SafeMathError
impl Display for SafeMathError
impl Eq for SafeMathError
Source§impl Error for SafeMathError
impl Error for SafeMathError
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<SafeMathError> for ProgramError
Available on crate feature quasar only.
impl From<SafeMathError> for ProgramError
Available on crate feature
quasar only.Source§fn from(e: SafeMathError) -> Self
fn from(e: SafeMathError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SafeMathError
impl PartialEq for SafeMathError
impl StructuralPartialEq for SafeMathError
Auto Trait Implementations§
impl Forget for SafeMathError
impl Freeze for SafeMathError
impl RefUnwindSafe for SafeMathError
impl Send for SafeMathError
impl Sync for SafeMathError
impl Unpin for SafeMathError
impl UnsafeUnpin for SafeMathError
impl UnwindSafe for SafeMathError
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