In Rust, you can use the std::env::consts module to get information about the target architecture.
To get the CPU architecture, you can use the arch function:
main.rs115 chars7 linesTo get the endianness of the target architecture, you can use the endianness function:
main.rs113 chars7 linesNote that some architectures, such as ARM, support multiple endianness modes. In this case, endianness will return either "little" or "big".
To get the target architecture itself (e.g. "x86_64" or "arm"), you can use the target_arch function:
main.rs124 chars7 linesSimilarly, to get the endianness of the target architecture, you can use the target_endian function:
main.rs126 chars7 linesgistlibby LogSnag