pub enum InvalidRadixExceptionKind {
ArgumentError,
RangeError,
}
Expand description
An enum describing which type of Ruby Exception
an InvalidRadixError
should be mapped to.
If the given radix falls outside the range of an i32
, the error should
be mapped to a RangeError
.
If the given radix falls within the range of an i32
, but outside the
range of 2..=36
(or -36..=-2
in some cases), the error should be mapped
to an ArgumentError
.
The error message for these Ruby exceptions should be derived from the
fmt::Display
implementation of InvalidRadixError
.
Variants§
ArgumentError
If the given radix falls within the range of an i32
, but outside the
range of 2..=36
(or -36..=-2 in some cases), the error should be
mapped to an ArgumentError
:
[3.1.2] > begin; Integer "123", 49; rescue => e; p e; end
#<ArgumentError: invalid radix 49>
[3.1.2] > begin; Integer "123", -49; rescue => e; p e; end
#<ArgumentError: invalid radix 49>
RangeError
If the given radix falls outside the range of an i32
, the error should
be mapped to a RangeError
:
[3.1.2] > begin; Integer "123", (2 ** 31 + 1); rescue => e; p e; end
#<RangeError: integer 2147483649 too big to convert to `int'>
[3.1.2] > begin; Integer "123", -(2 ** 31 + 1); rescue => e; p e; end
#<RangeError: integer -2147483649 too small to convert to `int'>
Trait Implementations§
Source§impl Clone for InvalidRadixExceptionKind
impl Clone for InvalidRadixExceptionKind
Source§fn clone(&self) -> InvalidRadixExceptionKind
fn clone(&self) -> InvalidRadixExceptionKind
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for InvalidRadixExceptionKind
impl Debug for InvalidRadixExceptionKind
Source§impl Hash for InvalidRadixExceptionKind
impl Hash for InvalidRadixExceptionKind
Source§impl Ord for InvalidRadixExceptionKind
impl Ord for InvalidRadixExceptionKind
Source§fn cmp(&self, other: &InvalidRadixExceptionKind) -> Ordering
fn cmp(&self, other: &InvalidRadixExceptionKind) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for InvalidRadixExceptionKind
impl PartialOrd for InvalidRadixExceptionKind
impl Copy for InvalidRadixExceptionKind
impl Eq for InvalidRadixExceptionKind
impl StructuralPartialEq for InvalidRadixExceptionKind
Auto Trait Implementations§
impl Freeze for InvalidRadixExceptionKind
impl RefUnwindSafe for InvalidRadixExceptionKind
impl Send for InvalidRadixExceptionKind
impl Sync for InvalidRadixExceptionKind
impl Unpin for InvalidRadixExceptionKind
impl UnwindSafe for InvalidRadixExceptionKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more