Module parse

Source
Available on crate feature alloc only.
Expand description

Parsing utilities.

Structs§

ContainsPrefixError
Error when hex string contains a prefix (e.g. 0x).
MissingPrefixError
Error returned when a hex string is missing a prefix (e.g. 0x).
ParseIntError
Error with rich context returned when a string can’t be parsed as an integer.

Enums§

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 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 a hex string.
int
Parses the input string as an integer returning an error carrying rich context.