[][src]Trait num::cast::NumCast

pub trait NumCast: ToPrimitive {
    fn from<T>(n: T) -> Option<Self>
    where
        T: ToPrimitive
; }
[]

An interface for casting between machine scalars.

Required methods

fn from<T>(n: T) -> Option<Self> where
    T: ToPrimitive
[]

Creates a number from another value that can be converted into a primitive via the ToPrimitive trait. If the source value cannot be represented by the target type, then None is returned.

Implementations on Foreign Types

impl NumCast for usize[src][]

impl<T> NumCast for Wrapping<T> where
    T: NumCast
[src][]

impl NumCast for i32[src][]

impl NumCast for u8[src][]

impl NumCast for u16[src][]

impl NumCast for i16[src][]

impl NumCast for u64[src][]

impl NumCast for i64[src][]

impl NumCast for isize[src][]

impl NumCast for f64[src][]

impl NumCast for u128[src][]

impl NumCast for f32[src][]

impl NumCast for i8[src][]

impl NumCast for i128[src][]

impl NumCast for u32[src][]

Implementors

impl<T> NumCast for Complex<T> where
    T: NumCast + Num
[src][+]

impl<T: NumCast + Num> NumCast for Complex<T>

impl<T: Float> NumCast for NotNan<T>