Skip to main content

transmute_neo

Function transmute_neo 

Source
pub const unsafe fn transmute_neo<Src, Dst>(src: Src) -> Dst
🔬This is a nightly-only experimental API. (transmute_neo #155079)
This item is validated for IEC 61508 (SIL 2) and ISO 26262 (ASIL B).
Expand description

New version of transmute, exposed under this name so it can be iterated upon without risking breakage to uses of “real” transmute.

Uses a const-assert to check the sizes instead of typeck hacks, but is semantially identical to transmute otherwise.

It will not be stabilized under this name.

§Examples

#![feature(transmute_neo)]
use std::mem::transmute_neo;

assert_eq!(unsafe { transmute_neo::<f32, u32>(0.0) }, 0);
#![feature(transmute_neo)]
use std::mem::transmute_neo;

unsafe { transmute_neo::<u32, u16>(123) };