Skip to main content

FromStrRadix

Trait FromStrRadix 

Source
pub trait FromStrRadix: Sized {
    type Err;

    // Required method
    fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::Err>;
}
Expand description

Conversion from a string in a given radix.

This is the standalone atom for the parsing capability that Num bundles; implement both for full compatibility. (Num keeps its own FromStrRadixErr associated type and method because associated types can’t be re-exported through supertraits.)

This is a plain (never-const) trait: string parsing is not const-evaluable for any of the primitive types today.

Required Associated Types§

Source

type Err

The parse error type.

Required Methods§

Source

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

Convert from a string and radix (typically 2..=36); see Num::from_str_radix for the conventions around supported radices.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FromStrRadix for f32

Source§

type Err = ParseFloatError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for f64

Source§

type Err = ParseFloatError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for i8

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for i16

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for i32

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for i64

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for i128

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for isize

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for u8

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for u16

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for u32

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for u64

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for u128

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl FromStrRadix for usize

Source§

type Err = ParseIntError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::Err>

Source§

impl<T: FromStrRadix> FromStrRadix for Saturating<T>

Source§

type Err = <T as FromStrRadix>::Err

Source§

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

Source§

impl<T: FromStrRadix> FromStrRadix for Wrapping<T>

Source§

type Err = <T as FromStrRadix>::Err

Source§

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

Implementors§