pub struct CpuFeatures {
pub sse42: bool,
pub avx2_fma: bool,
pub avx512: bool,
pub neon: bool,
}Expand description
Runtime-detected CPU capabilities. No compile-time target-cpu=native is
required, so one binary remains safe on older machines.
Fields§
§sse42: boolSSE4.2 available.
avx2_fma: boolAVX2 and FMA available.
avx512: boolAVX-512 foundation and DQ available.
neon: boolAArch64 NEON available.
Implementations§
Source§impl CpuFeatures
impl CpuFeatures
Sourcepub fn detect() -> CpuFeatures
pub fn detect() -> CpuFeatures
Detect features on the current process host.
Sourcepub const fn supports(self, instruction_set: CpuInstructionSet) -> bool
pub const fn supports(self, instruction_set: CpuInstructionSet) -> bool
Whether one implementation is safe to execute.
Sourcepub const fn best(self) -> CpuInstructionSet
pub const fn best(self) -> CpuInstructionSet
Best compiled-compatible specialization, or portable scalar.
Trait Implementations§
Source§impl Clone for CpuFeatures
impl Clone for CpuFeatures
Source§fn clone(&self) -> CpuFeatures
fn clone(&self) -> CpuFeatures
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CpuFeatures
impl Debug for CpuFeatures
Source§impl PartialEq for CpuFeatures
impl PartialEq for CpuFeatures
impl Copy for CpuFeatures
impl Eq for CpuFeatures
impl StructuralPartialEq for CpuFeatures
Auto Trait Implementations§
impl Freeze for CpuFeatures
impl RefUnwindSafe for CpuFeatures
impl Send for CpuFeatures
impl Sync for CpuFeatures
impl Unpin for CpuFeatures
impl UnwindSafe for CpuFeatures
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more