Trait num_traits::Num [] [src]

pub trait Num: PartialEq + Zero + One + Add<Output = Self> + Sub<Output = Self> + Mul<Output = Self> + Div<Output = Self> + Rem<Output = Self> {
    type FromStrRadixErr;
    fn from_str_radix(
        str: &str,
        radix: u32
    ) -> Result<Self, Self::FromStrRadixErr>; }

The base trait for numeric types

Associated Types

Required Methods

Convert from a string and radix <= 36.

Examples

use num_traits::Num;

let result = <i32 as Num>::from_str_radix("27", 10);
assert_eq!(result, Ok(27));

let result = <i32 as Num>::from_str_radix("foo", 10);
assert!(result.is_err());Run

Implementors