pub trait ElementOp<T>:
Sealed
+ Copy
+ 'staticwhere
T: NumericElement,{
// Required methods
unsafe fn apply<Arch>(
self,
a: <Arch as SimdKernel<T>>::Vector,
b: <Arch as SimdKernel<T>>::Vector,
) -> <Arch as SimdKernel<T>>::Vector
where Arch: SimdKernel<T>;
fn apply_scalar(self, a: T, b: T) -> T;
}Expand description
Sealed ZST trait for pairwise SIMD elementwise operations.
Used by zip_reduce, zip_cow, and transform_in_place to parameterize binary
vector operations without code duplication.
§Scalar Tail
apply_scalar(a, b) handles elements that do not fill a complete SIMD vector.
Implementations use direct T: Scalar arithmetic so no vector load/store
boundary conditions apply. The default does NOT exist — every impl must provide
both apply (vector) and apply_scalar (scalar element).
Required Methods§
Sourceunsafe fn apply<Arch>(
self,
a: <Arch as SimdKernel<T>>::Vector,
b: <Arch as SimdKernel<T>>::Vector,
) -> <Arch as SimdKernel<T>>::Vectorwhere
Arch: SimdKernel<T>,
unsafe fn apply<Arch>(
self,
a: <Arch as SimdKernel<T>>::Vector,
b: <Arch as SimdKernel<T>>::Vector,
) -> <Arch as SimdKernel<T>>::Vectorwhere
Arch: SimdKernel<T>,
Apply the operation to two vectors lane-wise.
Takes self by value — for ZSTs this is free; for Clamp it captures the bounds.
§Safety
Processor must support the target feature of Arch.
Sourcefn apply_scalar(self, a: T, b: T) -> T
fn apply_scalar(self, a: T, b: T) -> T
Apply the operation to two individual scalar elements.
Used for the SIMD tail (elements that do not fill a complete vector).
Takes self by value — for ZSTs this is free; for Clamp it captures the bounds.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".