There's an RFC about this:
With that RFC and existing From
/Into
impls you could write lossless and lossy casts as
let a = 10u8;
let b = a.into(): u16; // Lossless
let c = b.cast(): u8; // Lossy, catches overflows in debug mode
Unfortunately, From
/Into
impls for usize
and isize
met some resistance and weren't implemented yet.
(Speaking of D, its parentheses elision is great! With it these casts would look like b.cast: u8
)