3 unstable releases

Uses old Rust 2015

0.2.0 Apr 13, 2022
0.1.0 Mar 30, 2022

#5 in #target-triple

Download history 47715/week @ 2024-07-28 21831/week @ 2024-08-04 20576/week @ 2024-08-11 26545/week @ 2024-08-18 24274/week @ 2024-08-25 27959/week @ 2024-09-01 27837/week @ 2024-09-08 24075/week @ 2024-09-15 19183/week @ 2024-09-22 32107/week @ 2024-09-29 28788/week @ 2024-10-06 28186/week @ 2024-10-13 30981/week @ 2024-10-20 25133/week @ 2024-10-27 34658/week @ 2024-11-03 31750/week @ 2024-11-10

124,189 downloads per month
Used in 47 crates (21 directly)

MIT OR Apache-2.0 OR Zlib

7KB

current_platform

Find out what platform your code is running on, in Rust:

use current_platform::CURRENT_PLATFORM;

fn main() {
    println!("Running on {}", CURRENT_PLATFORM);
}

will print Running on x86_64-unknown-linux-gnu on desktop Linux.

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

The target triple for the platform where the code was compiled is also included as COMPILED_ON. It is only different from the CURRENT_PLATFORM if the code was cross-compiled. This is rarely useful; if in doubt, use CURRENT_PLATFORM.

This crate is intentionally minimal and only provides the target triples. 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).

No runtime deps