Expand description

Find out what platform your code is running on:

use current_platform::CURRENT_PLATFORM;
// docs.rs runs on x86 Linux
assert_eq!(CURRENT_PLATFORM, "x86_64-unknown-linux-gnu");

The target triple for the platform where the code was compiled is also included, see COMPILED_ON.

Platform information is resolved at compile time, based on the platform for which your code is compiled. It incurs zero runtime cost.

This crate is intentionally minimal and only provides the target triple. You can find out other properties of the platform using crates such as platforms (auto-generated, always up to date) or target-lexicon (more detailed but may be missing newly added or obscure platforms).

Constants

The platform on which your code was compiled.

The platform on which your code is running.