pub struct CpuFeatures {
pub avx2: bool,
pub neon: bool,
pub forced_scalar: bool,
}Expand description
Snapshot of the host CPU features detect_features cares about.
The struct is intentionally small and Copy: it is read on the hot
path of every distance call. New fields will be added in additive
releases — match on it exhaustively at your own risk.
The forced_scalar field reflects the value of the override at the
moment detect_features returned. Do not cache a CpuFeatures
across a force_scalar call: call detect_features each time
you need a fresh view.
§Examples
let features = iqdb_distance::detect_features();
// Repeated calls return the same value (snapshot is cached).
assert_eq!(features, iqdb_distance::detect_features());Fields§
§avx2: boolTrue if the host advertises AVX2 (x86_64 only). Always false on
other architectures.
neon: boolTrue if the host advertises NEON (aarch64 only). Always false on
other architectures.
forced_scalar: boolTrue if force_scalar has been called in this process. Once set,
the flag is read on every dispatch — see the force_scalar docs.
Trait Implementations§
Source§impl Clone for CpuFeatures
impl Clone for CpuFeatures
Source§fn clone(&self) -> CpuFeatures
fn clone(&self) -> CpuFeatures
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CpuFeatures
Source§impl Debug for CpuFeatures
impl Debug for CpuFeatures
impl Eq for CpuFeatures
Source§impl PartialEq for CpuFeatures
impl PartialEq for CpuFeatures
Source§fn eq(&self, other: &CpuFeatures) -> bool
fn eq(&self, other: &CpuFeatures) -> bool
self and other values to be equal, and is used by ==.