Rust has the ability to check configuration at build time with, e.g., #[cfg(target_os = \"linux\")]
or if cfg!(target_os = \"linux\") {...}
, where
See also https://internals.rust-lang.org/t/all-the-rust-features/4322 for a comprehensive list of features.
Bear in mind that some / most of the features won't be stabilized so will only be available in nightly for some time and are subject to breaking improvements / upgrades until they are either stabilized or discontinued.
Features in rust nightly is survival of the fittest.