[][src]Struct spinoso_math::DomainError

pub struct DomainError(_);

Error that indicates a math function evaluated to an out of range value.

Domain errors have an associated message.

This error corresponds to the Ruby Math::DomainError Exception class. It can be used to differentiate between NaN inputs and what would be NaN outputs.

Examples

let err = DomainError::new();
assert_eq!(err.message(), "Math::DomainError");

let err = DomainError::with_message(
    r#"Numerical argument is out of domain - "acos""#,
);
assert_eq!(err.message(), r#"Numerical argument is out of domain - "acos""#);

Implementations

impl DomainError[src]

#[must_use]pub const fn new() -> Self[src]

Construct a new, default domain error.

Examples

const ERR: DomainError = DomainError::new();
assert_eq!(ERR.message(), "Math::DomainError");

#[must_use]pub const fn with_message(message: &'static str) -> Self[src]

Construct a new, domaine error with a message.

Examples

const ERR: DomainError = DomainError::with_message(
    r#"Numerical argument is out of domain - "acos""#,
);
assert_eq!(ERR.message(), r#"Numerical argument is out of domain - "acos""#);

#[must_use]pub const fn message(self) -> &'static str[src]

Retrieve the exception message associated with this error.

Examples

let err = DomainError::new();
assert_eq!(err.message(), "Math::DomainError");

let err = DomainError::with_message(
    r#"Numerical argument is out of domain - "acos""#,
);
assert_eq!(err.message(), r#"Numerical argument is out of domain - "acos""#);

Trait Implementations

impl Clone for DomainError[src]

impl Copy for DomainError[src]

impl Debug for DomainError[src]

impl Default for DomainError[src]

impl Display for DomainError[src]

impl Eq for DomainError[src]

impl Error for DomainError[src]

impl From<&'static str> for DomainError[src]

impl From<DomainError> for Error[src]

impl Hash for DomainError[src]

impl Ord for DomainError[src]

impl PartialEq<DomainError> for DomainError[src]

impl PartialOrd<DomainError> for DomainError[src]

impl StructuralEq for DomainError[src]

impl StructuralPartialEq for DomainError[src]

Auto Trait Implementations

impl RefUnwindSafe for DomainError[src]

impl Send for DomainError[src]

impl Sync for DomainError[src]

impl Unpin for DomainError[src]

impl UnwindSafe for DomainError[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.