Cast between numeric types in rust with asΒΆ
!! question
Will casting from (for example) i64 to u16 possibly truncate the value? Presumably it's at least memory safe
Rust allows basic type-casting using the as keyword. Place as following the type you wish to cast:
let a: u32 = 1;
let b: i32 = a as i32;