Enum spinoso_math::Error
source · [−]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
sourceimpl 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
sourceimpl Error for Error
impl Error for Error
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<DomainError> for Error
impl From<DomainError> for Error
sourcefn from(err: DomainError) -> Self
fn from(err: DomainError) -> Self
Converts to this type from the input type.
sourceimpl From<NotImplementedError> for Error
impl From<NotImplementedError> for Error
sourcefn from(err: NotImplementedError) -> Self
fn from(err: NotImplementedError) -> Self
Converts to this type from the input type.
sourceimpl Ord for Error
impl Ord for Error
sourceimpl PartialOrd<Error> for Error
impl PartialOrd<Error> for Error
sourcefn partial_cmp(&self, other: &Error) -> Option<Ordering>
fn partial_cmp(&self, other: &Error) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Error
impl Eq for Error
impl StructuralEq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more