cpuid-bool 0.1.0

A lightweight no-std compatible alternative to is_x86_feature_detected
Documentation

Macro for checking CPU capabilities at runtime.

Usage example

if cpuid_bool::cpuid_bool!("sha", "aes") {
println!("CPU supports both SHA and AES extensions");
} else {
println!("SHA and AES extensions are not supported");
}

Note that if all tested target features are enabled via compiler options (e.g. by using RUSTFLAGS), cpuid_bool! macro immideatly will expand to true and will not use CPUID instruction. Such behavior allows compiler to eliminate fallback code.

After first call macro caches result and returns it in subsequent calls, thus runtime overhead for them is minimal.