Struct ParseIntError
pub struct ParseIntError { pub(in ::num) kind: IntErrorKind }
An error which can be returned when parsing an integer.
For example, this error is returned by the from_str_radix() functions
on the primitive integer types (such as i8::from_str_radix)
and is used as the error type in their FromStr implementations.
Potential causes
Among other causes, ParseIntError can be thrown because of leading or trailing whitespace
in the string e.g., when it is obtained from the standard input.
Using the [str::trim()] method ensures that no whitespace remains before parsing.
Example
if let Err = i32from_str_radix
Fields
kind: IntErrorKind
Implementations
impl ParseIntError
const fn kind(&self) -> &IntErrorKindOutputs the detailed cause of parsing an integer failing.
Trait Implementations
impl Clone for ParseIntError
fn clone(&self) -> ParseIntError
impl Debug for ParseIntError
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for ParseIntError
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for ParseIntError
fn assert_fields_are_eq(&self)
impl Error for ParseIntError
impl PartialEq for ParseIntError
fn eq(&self, other: &ParseIntError) -> bool
impl StructuralPartialEq for ParseIntError
Auto Trait Implementations
impl Freeze for ParseIntError
impl RefUnwindSafe for ParseIntError
impl Send for ParseIntError
impl Sync for ParseIntError
impl Unpin for ParseIntError
impl UnsafeUnpin for ParseIntError
impl UnwindSafe for ParseIntError
Blanket Implementations
impl<T> Any for ParseIntError
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ParseIntError
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ParseIntError
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for ParseIntError
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for ParseIntError
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for ParseIntError
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for ParseIntError
impl<T, U> Into<U> for ParseIntError
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ParseIntError
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for ParseIntError
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>