Trait Num
trait Num: PartialEq + Zero + One + NumOps
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 as >::FromStrRadixErr>Convert from a string and radix (typically
2..=36).Examples
use Num; let result = from_str_radix; assert_eq!; let result = from_str_radix; assert!;Supported radices
The exact range of supported radices is at the discretion of each type implementation. For primitive integers, this is implemented by the inherent
from_str_radixmethods in the standard library, which panic if the radix is not in the range from 2 to 36. The implementation in this crate for primitive floats is similar.For third-party types, it is suggested that implementations should follow suit and at least accept
2..=36without panicking, but anErrmay be returned for any unsupported radix. It's possible that a type might not even support the common radix 10, nor any, if string parsing doesn't make sense for that type.
Implementors
impl Num for u64impl Num for i32impl Num for u32impl Num for i16impl Num for u16impl Num for i8impl<T: Num> Num for Wrapping<T>impl Num for u8impl Num for isizeimpl Num for i128impl Num for f64impl Num for usizeimpl Num for u128impl Num for i64impl Num for f32