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.

Required Associated Types§

Required Methods§

source

fn from_str_radix(src: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Provided Methods§

Implementations on Foreign Types§

source§

impl ParseInt for i16

source§

impl ParseInt for usize

source§

impl ParseInt for u8

source§

impl ParseInt for i128

source§

impl ParseInt for i32

source§

impl ParseInt for u32

source§

impl ParseInt for isize

source§

impl ParseInt for u64

source§

impl ParseInt for u16

source§

impl ParseInt for Vec<u8>

source§

impl ParseInt for i64

source§

impl ParseInt for u128

source§

impl ParseInt for i8

Implementors§