pub unsafe trait Vector: Copy {
type Scalar: Copy;
type Token: Token;
type Width: Width;
type Underlying: Copy;
Show 16 methods
// Required methods
fn zeroed(token: Self::Token) -> Self;
fn splat(token: Self::Token, from: Self::Scalar) -> Self;
// Provided methods
fn width() -> usize { ... }
fn to_token(self) -> Self::Token { ... }
fn as_slice(&self) -> &[Self::Scalar] { ... }
fn as_slice_mut(&mut self) -> &mut [Self::Scalar] { ... }
fn to_underlying(self) -> Self::Underlying { ... }
fn from_underlying(token: Self::Token, underlying: Self::Underlying) -> Self { ... }
unsafe fn read_ptr(token: Self::Token, from: *const Self::Scalar) -> Self { ... }
unsafe fn read_aligned_ptr(
token: Self::Token,
from: *const Self::Scalar,
) -> Self { ... }
unsafe fn read_unchecked(token: Self::Token, from: &[Self::Scalar]) -> Self { ... }
fn read(token: Self::Token, from: &[Self::Scalar]) -> Self { ... }
unsafe fn write_ptr(self, to: *mut Self::Scalar) { ... }
unsafe fn write_aligned_ptr(self, to: *mut Self::Scalar) { ... }
unsafe fn write_unchecked(self, to: &mut [Self::Scalar]) { ... }
fn write(self, to: &mut [Self::Scalar]) { ... }
}Expand description
The fundamental vector type.
§Safety
This trait may only be implemented for types that have the memory layout of an array of
Scalar with length width().
Required Associated Types§
Sourcetype Underlying: Copy
type Underlying: Copy
The underlying type
Required Methods§
Provided Methods§
Sourcefn as_slice_mut(&mut self) -> &mut [Self::Scalar]
fn as_slice_mut(&mut self) -> &mut [Self::Scalar]
Returns a mutable slice containing the vector.
Sourcefn to_underlying(self) -> Self::Underlying
fn to_underlying(self) -> Self::Underlying
Converts this vector to its underlying type.
Sourcefn from_underlying(token: Self::Token, underlying: Self::Underlying) -> Self
fn from_underlying(token: Self::Token, underlying: Self::Underlying) -> Self
Converts the underlying type to a vector.
Sourceunsafe fn read_aligned_ptr(
token: Self::Token,
from: *const Self::Scalar,
) -> Self
unsafe fn read_aligned_ptr( token: Self::Token, from: *const Self::Scalar, ) -> Self
Read from a vector-aligned pointer.
§Safety
frommust point to an array of length at leastwidth().frommust be aligned for the vector type.
Sourceunsafe fn read_unchecked(token: Self::Token, from: &[Self::Scalar]) -> Self
unsafe fn read_unchecked(token: Self::Token, from: &[Self::Scalar]) -> Self
Read from a vector-aligned pointer. Read from a slice without checking the length.
§Safety
frombe length at leastwidth().
Sourceunsafe fn write_aligned_ptr(self, to: *mut Self::Scalar)
unsafe fn write_aligned_ptr(self, to: *mut Self::Scalar)
Write to a pointer.
§Safety
from must point to an array of length at least width()
from must be aligned for the vector type.
Sourceunsafe fn write_unchecked(self, to: &mut [Self::Scalar])
unsafe fn write_unchecked(self, to: &mut [Self::Scalar])
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.