pub enum ParseError {
Empty,
InvalidDigit,
PosOverflow,
NegOverflow,
Zero,
Signed,
InvalidRadix,
Unknown,
}Expand description
Enum to store the various types of errors that can cause parsing Big Integer to fail.
§Example
use fastnum::U256;
if let Err(e) = U256::from_str_radix("a12", 10) {
println!("Failed conversion to U256: {e}");
}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.
Signed
Value was Signed
This variant will be emitted when the parsing string has a sign literal, which would be illegal for unsigned types.
InvalidRadix
Invalid radix.
Unknown
Unknown error.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ParseError
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()