Struct core::num::ParseIntError
1.0.0 · source · [−]pub struct ParseIntError { /* private fields */ }Expand description
An error which can be returned when parsing an integer.
This error is used as the error type for the from_str_radix() functions
on the primitive integer types, such as i8::from_str_radix.
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(e) = i32::from_str_radix("a12", 10) {
println!("Failed conversion to i32: {e}");
}RunImplementations
impl ParseIntError
source
impl ParseIntError
sourcepub fn kind(&self) -> &IntErrorKind
1.55.0 · source
pub fn kind(&self) -> &IntErrorKind
1.55.0 · sourceOutputs the detailed cause of parsing an integer failing.
Trait Implementations
impl Clone for ParseIntError
source
impl Clone for ParseIntError
sourcefn clone(&self) -> ParseIntError
source
fn clone(&self) -> ParseIntError
sourceReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
source
fn clone_from(&mut self, source: &Self)
sourcePerforms copy-assignment from source. Read more
impl Debug for ParseIntError
source
impl Debug for ParseIntError
sourceimpl Display for ParseIntError
source
impl Display for ParseIntError
sourceimpl PartialEq<ParseIntError> for ParseIntError
source
impl PartialEq<ParseIntError> for ParseIntError
sourcefn eq(&self, other: &ParseIntError) -> bool
source
fn eq(&self, other: &ParseIntError) -> bool
sourceThis method tests for self and other values to be equal, and is used
by ==. Read more
fn ne(&self, other: &ParseIntError) -> bool
source
fn ne(&self, other: &ParseIntError) -> bool
sourceThis method tests for !=.
impl Eq for ParseIntError
sourceimpl StructuralEq for ParseIntError
sourceimpl StructuralPartialEq for ParseIntError
sourceAuto Trait Implementations
impl RefUnwindSafe for ParseIntError
impl Send for ParseIntError
impl Sync for ParseIntError
impl Unpin for ParseIntError
impl UnwindSafe for ParseIntError
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
source
impl<T> BorrowMut<T> for T where
T: ?Sized,
sourcefn borrow_mut(&mut self) -> &mut T
const: unstable · source
fn borrow_mut(&mut self) -> &mut T
const: unstable · sourceMutably borrows from an owned value. Read more