Skip to main content

has

Function has 

Source
pub fn has(feature: Feature) -> bool
Expand description

Whether this machine supports feature: the same answer as std’s is_x86_feature_detected! and is_aarch64_feature_detected!, which the compiler’s #[target_feature] dispatch trusts.

use sys_lib::cpu::{self, Feature};

if cpu::has(Feature::Avx2) {
    // pick the AVX2 kernel
}