Skip to main content

native_arch_if_emulated

Function native_arch_if_emulated 

Source
pub fn native_arch_if_emulated() -> Option<String>
Expand description

The machine’s own architecture, reported only when it differs from this build’s.

std::env::consts::ARCH is baked in at compile time, so a 32-bit build on a 64-bit machine reports x86 and looks, to anyone reading it, like a claim about the hardware. Windows sets constants::ENV_NATIVE_ARCH under WOW64 and under ARM64 emulation; it is the only thing an emulated process can ask. The names are mapped to Rust’s spellings so the two halves of “x86, but this machine is x86_64” match.

None means the build and the machine agree, or the question cannot be answered — both of which are reported as nothing at all rather than as a guess.