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§
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)>
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 PartialEq<Error> for Error
impl PartialEq<Error> for Error
source§impl PartialOrd<Error> for Error
impl PartialOrd<Error> for Error
1.0.0 · source§fn 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