pub unsafe trait Select<T, N: ArrayLength> {
// Required method
fn select(
self,
true_values: NumericArray<T, N>,
false_values: NumericArray<T, N>,
) -> NumericArray<T, N>;
}Expand description
Selects elements from one array or another using self as a mask.
Required Methods§
Sourcefn select(
self,
true_values: NumericArray<T, N>,
false_values: NumericArray<T, N>,
) -> NumericArray<T, N>
fn select( self, true_values: NumericArray<T, N>, false_values: NumericArray<T, N>, ) -> NumericArray<T, N>
Selects elements from one array or another using self as a mask.
Example:
ⓘ
use numeric_array::simd::Select;
let mask = narr![bool; true, false, false, true];
let a = narr![i32; 1, 2, 3, 4];
let b = narr![i32; 5, 6, 7, 8];
// Compiles to vblendvps on my machine
let selected = mask.select(a, b);
assert_eq!(selected, narr![i32; 1, 6, 7, 4]);NOTE: The default implementation of this will clamp the index values to the length of the array.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".