The SimdDescriptor trait is the core abstraction for accessing SIMD (Single Instruction, Multiple Data) capabilities in jxl-rs. It provides a unified interface for different CPU architectures (x86_64, AArch64, WASM32) and instruction sets (AVX, AVX512, SSE4.2, NEON, SIMD128).
To use SIMD, you typically call SimdDescriptor::new() to attempt to obtain a descriptor for the current hardware. If successful, you use the descriptor to perform operations on specialized vector types like F32Vec, I32Vec, U32Vec, etc.
A critical method is call<R>(self, f: impl FnOnce(Self) -> R) -> R. This method allows you to execute a closure within the correct target feature context, ensuring that SIMD intrinsics can be used safely and efficiently without breaking the inline function chain.
// Example of obtaining a descriptor and using it within a feature context
if let Some(d) = <MyDescriptor as SimdDescriptor>::new() {
d.call(|d| {
// Perform SIMD operations here using d
});
}