pub unsafe trait SimdElement: Sized {
type Vector: Sized + Copy;
const VECTOR_LEN: usize;
// Required methods
fn is_available() -> bool;
unsafe fn load(src: *const Self) -> Self::Vector;
unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector;
unsafe fn store(dst: *mut Self, src: Self::Vector);
unsafe fn store_partial(dst: *mut Self, src: Self::Vector, len: usize);
unsafe fn set(value: Self) -> Self::Vector;
}Expand description
A trait for types that may be used as SIMD vector elements.
Required Associated Constants§
Sourceconst VECTOR_LEN: usize
const VECTOR_LEN: usize
Capacity of Vector
Required Associated Types§
Required Methods§
Sourcefn is_available() -> bool
fn is_available() -> bool
Returns these SIMD functions are available.
Sourceunsafe fn load(src: *const Self) -> Self::Vector
unsafe fn load(src: *const Self) -> Self::Vector
Loads values to raw SIMD vector.
§Safety
Make sure Self::is_available() returns true and length of src is not less than Self::VECTOR_LEN.
Sourceunsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector
unsafe fn load_partial(src: *const Self, len: usize) -> Self::Vector
Loads values to raw SIMD vector.
§Safety
Make sure Self::is_available() returns true and length of src is not less than len.
Sourceunsafe fn store(dst: *mut Self, src: Self::Vector)
unsafe fn store(dst: *mut Self, src: Self::Vector)
Stores raw SIMD vector to dst.
§Safety
Make sure Self::is_available() returns true and capacity of dst is not less than Self::VECTOR_LEN.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.