pub enum Error {
Domain(DomainError),
NotImplemented(NotImplementedError),
}
Expand description
Sum type of all errors possibly returned from Math
functions.
Math functions in spinoso-math
return errors in the following conditions:
- The parameters evaluate to a result that is out of range.
- The function is not implemented due to missing compile-time flags.
Variants§
Domain(DomainError)
Error that indicates a math function returned a value that was out of range.
This error can be used to differentiate between NaN
inputs
and what would be NaN
outputs.
See DomainError
.
NotImplemented(NotImplementedError)
Error that indicates a Math
module function is not implemented.
See NotImplementedError
.
Implementations§
Source§impl Error
impl Error
Sourcepub const fn message(self) -> &'static str
pub const fn message(self) -> &'static str
Retrieve the exception message associated with this error.
§Examples
let err = Error::from(DomainError::new());
assert_eq!(err.message(), "Math::DomainError");
let err = Error::from(NotImplementedError::with_message(
"Artichoke was not built with Math::erf support",
));
assert_eq!(
err.message(),
"Artichoke was not built with Math::erf support"
);
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<DomainError> for Error
impl From<DomainError> for Error
Source§fn from(err: DomainError) -> Self
fn from(err: DomainError) -> Self
Converts to this type from the input type.
Source§impl From<NotImplementedError> for Error
impl From<NotImplementedError> for Error
Source§fn from(err: NotImplementedError) -> Self
fn from(err: NotImplementedError) -> Self
Converts to this type from the input type.
Source§impl Ord for Error
impl Ord for Error
Source§impl PartialOrd for Error
impl PartialOrd for Error
impl Copy for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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