num_traits::cast

Function cast

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

Cast from one machine scalar to another.

ยงExamples

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