Created
January 4, 2022 16:24
-
-
Save eduardonunesp/7ee890172f3d84122e6a0501dd87c2d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if cfg!(target_os = "windows") { /* ... */ } | |
#[cfg(target_os = "linux")] // can be linux android windows macos ios | |
#[cfg(target_pointer_width = 64)] // target 64 bit systems | |
#[cfg(target_pointer_width = 32)] // target 32 bit systems | |
// Compiler features | |
#![feature(feature1, feature2, feature3)] | |
#[cfg(feature = "foo")] | |
// combining multiple conditions | |
#[cfg(any(unix, windows))] | |
#[cfg(not(macos))] | |
#[cfg(not(unix), all(target_os="macos", target_arch = "powerpc"))] | |
#![plugin(foo, bar)] | |
// Load a module from a specified file | |
#[path = "foo.rs"] | |
mod bar; | |
// Set crate type to library | |
#![crate_type = "lib"] | |
// You can set attributes based on a cfg variable | |
#[cfg_attr("is_cool", windows)] // sets the is_cool attribute if compiling for windows | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment