Skip to content

Find out what platform your code is running on from Rust

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.md
MIT
LICENSE-MIT.md
Zlib
LICENSE-ZLIB.md
Notifications You must be signed in to change notification settings

Shnatsel/current_platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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).

About

Find out what platform your code is running on from Rust

Topics

Resources

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.md
MIT
LICENSE-MIT.md
Zlib
LICENSE-ZLIB.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages