Trait num_traits::Num [−][src]
pub trait Num: PartialEq + Zero + One + NumOps { type FromStrRadixErr; fn from_str_radix(
str: &str,
radix: u32
) -> Result<Self, Self::FromStrRadixErr>; }
The base trait for numeric types, covering 0
and 1
values,
comparisons, basic numeric operations, and string conversion.
Associated Types
type FromStrRadixErr
Required Methods
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
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());
Implementations on Foreign Types
impl Num for usize
[src]
impl Num for usize
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for u8
[src]
impl Num for u8
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for u16
[src]
impl Num for u16
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for u32
[src]
impl Num for u32
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for u64
[src]
impl Num for u64
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for isize
[src]
impl Num for isize
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for i8
[src]
impl Num for i8
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for i16
[src]
impl Num for i16
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for i32
[src]
impl Num for i32
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for i64
[src]
impl Num for i64
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for u128
[src]
impl Num for u128
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl Num for i128
[src]
impl Num for i128
type FromStrRadixErr = ParseIntError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseIntError>
impl<T: Num> Num for Wrapping<T> where
Wrapping<T>: Add<Output = Wrapping<T>> + Sub<Output = Wrapping<T>> + Mul<Output = Wrapping<T>> + Div<Output = Wrapping<T>> + Rem<Output = Wrapping<T>>,
[src]
impl<T: Num> Num for Wrapping<T> where
Wrapping<T>: Add<Output = Wrapping<T>> + Sub<Output = Wrapping<T>> + Mul<Output = Wrapping<T>> + Div<Output = Wrapping<T>> + Rem<Output = Wrapping<T>>,
type FromStrRadixErr = T::FromStrRadixErr
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
[src]
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
impl Num for f32
[src]
impl Num for f32
type FromStrRadixErr = ParseFloatError
fn from_str_radix(src: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
[src]
fn from_str_radix(src: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
impl Num for f64
[src]
impl Num for f64
type FromStrRadixErr = ParseFloatError
fn from_str_radix(src: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
[src]
fn from_str_radix(src: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>