pub struct ParseIntError { /* private fields */ }Expand description
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
Implementationsยง
Sourceยงimpl ParseIntError
impl ParseIntError
1.55.0 (const: 1.82.0) ยท Sourcepub const fn kind(&self) -> &IntErrorKind
pub const fn kind(&self) -> &IntErrorKind
Outputs the detailed cause of parsing an integer failing.
Trait Implementationsยง
1.0.0 ยท Sourceยงimpl Clone for ParseIntError
impl Clone for ParseIntError
Sourceยงfn clone(&self) -> ParseIntError
fn clone(&self) -> ParseIntError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more1.0.0 ยท Sourceยงimpl Debug for ParseIntError
impl Debug for ParseIntError
1.0.0 ยท Sourceยงimpl Display for ParseIntError
impl Display for ParseIntError
impl Eq for ParseIntError
1.0.0 ยท Sourceยงimpl Error for ParseIntError
impl Error for ParseIntError
1.30.0 ยท Sourceยงfn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 ยท Sourceยงfn description(&self) -> &str
fn description(&self) -> &str
๐Deprecated since 1.42.0:
use the Display impl or to_string()
1.0.0 ยท Sourceยงimpl PartialEq for ParseIntError
impl PartialEq for ParseIntError
Sourceยงfn eq(&self, other: &ParseIntError) -> bool
fn eq(&self, other: &ParseIntError) -> bool
Tests for
self and other values to be equal, and is used by ==.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ยง
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