Struct spinoso_random::ArgumentError[][src]

pub struct ArgumentError(_);

Error that indicates a random number could not be generated with the given bounds.

This error is returned by rand(). See its documentation for more details.

This error corresponds to the Ruby ArgumentError Exception class.

Examples

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

Implementations

impl ArgumentError[src]

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

Construct a new, default argument error.

Examples

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

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

Construct a new domain error.

Examples

const ERR: ArgumentError = ArgumentError::domain_error();
assert_eq!(ERR.message(), "Numerical argument out of domain");

#[must_use]pub const fn with_rand_max(max: Max) -> Self[src]

This is supported on crate feature random-rand only.

Construct a new argument error from an invalid Max constraint.

Examples

const ERR: ArgumentError = ArgumentError::with_rand_max(Max::Integer(-1));
assert_eq!(ERR.message(), "invalid argument");

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

Retrieve the exception message associated with this new seed error.

Implementation notes

Argument errors constructed with ArgumentError::with_rand_max return an incomplete error message. Prefer to use the Display impl to retrieve error messages from ArgumentError.

Examples

let err = ArgumentError::new();
assert_eq!(err.message(), "ArgumentError");
let err = ArgumentError::domain_error();
assert_eq!(err.message(), "Numerical argument out of domain");

#[must_use]pub const fn is_domain_error(self) -> bool[src]

Return whether this argument error is a domain error.

Domain errors are typically reported as Errno::EDOM in MRI.

Examples

let err = ArgumentError::domain_error();
assert!(err.is_domain_error());
let err = ArgumentError::new();
assert!(!err.is_domain_error());

Trait Implementations

impl Clone for ArgumentError[src]

impl Copy for ArgumentError[src]

impl Debug for ArgumentError[src]

impl Display for ArgumentError[src]

impl Error for ArgumentError[src]

impl From<ArgumentError> for Error[src]

impl PartialEq<ArgumentError> for ArgumentError[src]

impl PartialOrd<ArgumentError> for ArgumentError[src]

impl StructuralPartialEq for ArgumentError[src]

Auto Trait Implementations

impl RefUnwindSafe for ArgumentError

impl Send for ArgumentError

impl Sync for ArgumentError

impl Unpin for ArgumentError

impl UnwindSafe for ArgumentError

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]