Trait opentitanlib::util::parse_int::ParseInt
source · pub trait ParseInt: Sized {
type FromStrRadixErr: Into<ParseIntError>;
// Required method
fn from_str_radix(
src: &str,
radix: u32
) -> Result<Self, Self::FromStrRadixErr>;
// Provided method
fn from_str(src: &str) -> Result<Self, ParseIntError> { ... }
}
Expand description
Trait for parsing integers.
Strings beginning with the common and classic prefixes 0x
, 0o
, 0b
or 0
are parsed
as hex, octal, binary, and octal (classic). Anything else is parsed as decimal.
A leading +
or -
is permitted. Any string parsed by strtol(3)
or strtoul(3)
will be parsed successfully.