Skip to main content

Module parse_int

Module parse_int 

Source
Expand description

Parsing utilities.

Structs§

ParseIntError
Error with rich context returned when a string can’t be parsed as an integer.
PrefixedHexError
Error returned when parsing an integer from a hex string that is supposed to contain a prefix.
UnprefixedHexError
Error returned when parsing an integer from a hex string that is not supposed to contain a prefix.

Traits§

Integer
Not strictly necessary but serves as a lint - avoids weird behavior if someone accidentally passes non-integer to the parse() function.

Functions§

hex_check_unprefixed
Checks a hex string does not have a prefix 0x (or 0X).
hex_remove_prefix
Removes the prefix 0x (or 0X) from a hex string.
hex_u32
Parses a u32 from a hex string.
hex_u32_prefixed
Parses a u32 from a prefixed hex string.
hex_u32_unchecked
Parses a u32 from an unprefixed hex string without first checking for a prefix.
hex_u32_unprefixed
Parses a u32 from an unprefixed hex string.
hex_u128
Parses a u128 from a hex string.
hex_u128_prefixed
Parses a u128 from a prefixed hex string.
hex_u128_unchecked
Parses a u128 from an unprefixed hex string without first checking for a prefix.
hex_u128_unprefixed
Parses a u128 from an unprefixed hex string.
int_from_box
Parses the input string as an integer returning an error carrying rich context.
int_from_str
Parses the input string as an integer returning an error carrying rich context.
int_from_string
Parses the input string as an integer returning an error carrying rich context.