Module std_detect::detect
source · 🔬This is a nightly-only experimental API. (
stdsimd
)Expand description
This module implements run-time feature detection.
The is_{arch}_feature_detected!("feature-name")
macros take the name of a
feature as a string-literal, and return a boolean indicating whether the
feature is enabled at run-time or not.
These macros do two things:
- map the string-literal into an integer stored as a
Feature
enum, - call a
os::check_for(x: Feature)
function that returnstrue
if the feature is enabled.
The Feature
enums are also implemented in the arch/{target_arch}.rs
modules.
The check_for
functions are, in general, Operating System dependent. Most
architectures do not allow user-space programs to query the feature bits
due to security concerns (x86 is the big exception). These functions are
implemented in the os/{target_os}.rs
modules.
Modules
- Bit manipulation utilities.
- Caches run-time feature detection so that it only needs to be computed once.
- x86 run-time feature detection is OS independent.
Functions
- Performs run-time feature detection.
- featuresExperimentalReturns an
Iterator<Item=(&'static str, bool)>
whereItem.0
is the feature name, andItem.1
is abool
which istrue
if the feature is supported by the host andfalse
otherwise.