Enum IntErrorKind

enum IntErrorKind

Enum to store the various types of errors that can cause parsing an integer to fail.

Example

# fn main() {
if let Err(e) = i32::from_str_radix("a12", 10) {
    println!("Failed conversion to i32: {:?}", e.kind());
}
# }

Variants

Empty

Value being parsed is empty.

This variant will be constructed when parsing an empty string.

InvalidDigit

Contains an invalid digit in its context.

Among other causes, this variant will be constructed when parsing a string that contains a non-ASCII char.

This variant is also constructed when a + or - is misplaced within a string either on its own or in the middle of a number.

PosOverflow

Integer is too large to store in target integer type.

NegOverflow

Integer is too small to store in target integer type.

Zero

Value was Zero

This variant will be emitted when the parsing string has a value of zero, which would be illegal for non-zero types.

Implementations

impl Clone for IntErrorKind

fn clone(self: &Self) -> IntErrorKind

impl Copy for IntErrorKind

impl Debug for IntErrorKind

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Eq for IntErrorKind

impl Freeze for IntErrorKind

impl Hash for IntErrorKind

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl PartialEq for IntErrorKind

fn eq(self: &Self, other: &IntErrorKind) -> bool

impl RefUnwindSafe for IntErrorKind

impl Send for IntErrorKind

impl StructuralPartialEq for IntErrorKind

impl Sync for IntErrorKind

impl Unpin for IntErrorKind

impl UnsafeUnpin for IntErrorKind

impl UnwindSafe for IntErrorKind

impl<T> Any for IntErrorKind

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for IntErrorKind

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for IntErrorKind

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for IntErrorKind

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for IntErrorKind

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for IntErrorKind

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for IntErrorKind

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for IntErrorKind

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>