Trait Vector

Source
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§

Source

type Scalar: Copy

The type of elements in the vector.

Source

type Token: Token

The token that proves support for this vector on the CPU.

Source

type Width: Width

The number of elements in the vector.

Source

type Underlying: Copy

The underlying type

Required Methods§

Source

fn zeroed(token: Self::Token) -> Self

Create a new vector with each lane containing zeroes.

Source

fn splat(token: Self::Token, from: Self::Scalar) -> Self

Create a new vector with each lane containing the provided value.

Provided Methods§

Source

fn width() -> usize

Returns the number of lanes.

Source

fn to_token(self) -> Self::Token

Creates a new instance of Token from a vector.

Source

fn as_slice(&self) -> &[Self::Scalar]

Returns a slice containing the vector.

Source

fn as_slice_mut(&mut self) -> &mut [Self::Scalar]

Returns a mutable slice containing the vector.

Source

fn to_underlying(self) -> Self::Underlying

Converts this vector to its underlying type.

Source

fn from_underlying(token: Self::Token, underlying: Self::Underlying) -> Self

Converts the underlying type to a vector.

Source

unsafe fn read_ptr(token: Self::Token, from: *const Self::Scalar) -> Self

Read from a pointer.

§Safety
  • from must point to an array of length at least width().
Source

unsafe fn read_aligned_ptr( token: Self::Token, from: *const Self::Scalar, ) -> Self

Read from a vector-aligned pointer.

§Safety
  • from must point to an array of length at least width().
  • from must be aligned for the vector type.
Source

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
  • from be length at least width().
Source

fn read(token: Self::Token, from: &[Self::Scalar]) -> Self

Read from a slice.

§Panic

Panics if the length of from is less than width().

Source

unsafe fn write_ptr(self, to: *mut Self::Scalar)

Write to a pointer.

§Safety

from must point to an array of length at least width()

Source

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.

Source

unsafe fn write_unchecked(self, to: &mut [Self::Scalar])

Write to a slice without checking the length.

§Safety

from must be length at least width().

Source

fn write(self, to: &mut [Self::Scalar])

Write to a slice.

§Panics

Panics if the length of from is less than width().

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.

Implementors§

Source§

impl Vector for cf32x1

Source§

impl Vector for generic_simd::arch::generic::cf64x1

Source§

impl Vector for f32x1

Source§

impl Vector for f64x1

Source§

impl Vector for cf32x2

Source§

impl Vector for cf32x4

Source§

impl Vector for generic_simd::arch::x86::cf64x1

Source§

impl Vector for cf64x2

Source§

impl Vector for f32x4

Source§

impl Vector for f32x8

Source§

impl Vector for f64x2

Source§

impl Vector for f64x4

Source§

impl<Underlying, Scalar> Vector for Shim2<Underlying, Scalar>
where Underlying: Vector<Scalar = Scalar>, Underlying::Width: Double, Scalar: Copy,

Source§

type Scalar = Scalar

Source§

type Token = <Underlying as Vector>::Token

Source§

type Width = <<Underlying as Vector>::Width as Double>::Doubled

Source§

type Underlying = [<Underlying as Vector>::Underlying; 2]

Source§

impl<Underlying, Scalar, Token> Vector for ShimToken<Underlying, Scalar, Token>
where Underlying: Vector<Scalar = Scalar>, Scalar: Copy, Token: Token + Into<<Underlying as Vector>::Token>,

Source§

type Scalar = Scalar

Source§

type Token = Token

Source§

type Width = <Underlying as Vector>::Width

Source§

type Underlying = <Underlying as Vector>::Underlying