Rust has the ability to verify the configuration during assembly using, for example, #[cfg(target_os = "linux")]or if cfg!(target_os = "linux") {...}, where is a target_osfunction.
#[cfg(target_os = "linux")]
if cfg!(target_os = "linux") {...}
target_os
Is there a list of all (or at least commonly used) functions that can be tested in Rust?
See related question on attributes. Is there an exhaustive list of standard attributes anywhere? .
In the "Conditional Compilation" section of the link there is a list of configurations that must be defined (starting with Rust 1.14):
target_arch
x86
x86_64
mips
powerpc
powerpc64
arm
aarch64
windows
macos
ios
linux
android
freebsd
dragonfly
bitrig
openbsd
netbsd
target_family
unix
target_env
gnu
msvc
musl
""
target_endian
little
big
target_pointer_width
32
64
target_has_atomic
8
16
ptr
target_vendor
apple
pc
unknown
test
debug_assertions
. https://internals.rust-lang.org/t/all-the-rust-features/4322 .
, / , , .
- .
Source: https://habr.com/ru/post/1667257/More articles:Is it possible to add names and descriptions for validation rules in the laravel request class - phpArabic numerals with ar-ae and ar-sa locale in Android - androidDefault Cache Manager with Spring Boot using @EnableCaching - spring-bootHow to speed up operations with normal oracle operations? - javaE / GED: could not get GED Log Buf, err (0) - Logcat error in android Studio - androidIs there an exhaustive list of standard attributes? - rustFilter rows by last maximum ordinal value by time - rHow to delete a cell in a tableView by clicking a button in a cell? Using coreData - iosThere is no such command registered in ipython - pythonDELETE when using FOREACH in neo4j - performanceAll Articles