[−][src]Struct spinoso_random::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]
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]
fn clone(&self) -> ArgumentError
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for ArgumentError
[src]
impl Debug for ArgumentError
[src]
impl Display for ArgumentError
[src]
impl Error for ArgumentError
[src]
pub fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
pub fn backtrace(&self) -> Option<&Backtrace>
[src]
pub fn description(&self) -> &str
1.0.0[src]
pub fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl From<ArgumentError> for Error
[src]
fn from(err: ArgumentError) -> Self
[src]
impl PartialEq<ArgumentError> for ArgumentError
[src]
fn eq(&self, other: &ArgumentError) -> bool
[src]
fn ne(&self, other: &ArgumentError) -> bool
[src]
impl PartialOrd<ArgumentError> for ArgumentError
[src]
fn partial_cmp(&self, other: &ArgumentError) -> Option<Ordering>
[src]
fn lt(&self, other: &ArgumentError) -> bool
[src]
fn le(&self, other: &ArgumentError) -> bool
[src]
fn gt(&self, other: &ArgumentError) -> bool
[src]
fn ge(&self, other: &ArgumentError) -> bool
[src]
impl StructuralPartialEq for ArgumentError
[src]
Auto Trait Implementations
impl RefUnwindSafe for ArgumentError
[src]
impl Send for ArgumentError
[src]
impl Sync for ArgumentError
[src]
impl Unpin for ArgumentError
[src]
impl UnwindSafe for ArgumentError
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,