Function num::traits::cast [-] [+] [src]

pub fn cast<T: NumCast, U: NumCast>(n: T) -> Option<U>

Cast from one machine scalar to another.

Examples

extern crate num; fn main() { use num; let twenty: f32 = num::traits::cast(0x14).unwrap(); assert_eq!(twenty, 20f32); }
use num;

let twenty: f32 = num::traits::cast(0x14).unwrap();
assert_eq!(twenty, 20f32);