Function std::num::castUnstable [-] [+] [src]

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

Cast from one machine scalar to another.

Example

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

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