3 unstable releases

Uses old Rust 2015

0.2.0 Apr 13, 2022
0.1.0 Mar 30, 2022

#418 in Development tools

Download history 5938/week @ 2023-11-23 6218/week @ 2023-11-30 7028/week @ 2023-12-07 6554/week @ 2023-12-14 5312/week @ 2023-12-21 5059/week @ 2023-12-28 8069/week @ 2024-01-04 9464/week @ 2024-01-11 10168/week @ 2024-01-18 9306/week @ 2024-01-25 9055/week @ 2024-02-01 8183/week @ 2024-02-08 9843/week @ 2024-02-15 10508/week @ 2024-02-22 11622/week @ 2024-02-29 7865/week @ 2024-03-07

41,323 downloads per month
Used in 22 crates (17 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