如果体系结构是32位还是64位,如何检查Rust?

如果有条件检查处理器是32位还是64位?我正在寻找一种配置检查,例如#cfg [x86]或cfg [x64].
最佳答案
您应该查看conditional compilation上的Rust Reference章节:

target_arch = "..." – Target CPU architecture, such as "x86", "x86_64", "mips", "powerpc", "powerpc64", "arm", or "aarch64". This value is closely related to the first element of the platform target triple, though it is not identical.

转载注明原文:如果体系结构是32位还是64位,如何检查Rust? - 代码日志