Skip to main content

Vector

Trait Vector 

Source
pub trait Vector<T, const N: usize>:
    Copy
    + Clone
    + Send
    + Sync
    + 'static
    + Default
    + PartialEq
    + Debug
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + Rem<Output = Self>
    + Neg<Output = Self>
where T: Scalar,
{
Show 15 methods // Required methods fn splat(value: T) -> Self; fn load(slice: &[T]) -> Self; fn store(&self, slice: &mut [T]); fn extract(&self, index: usize) -> T; fn insert(&self, index: usize, value: T) -> Self; fn add(&self, other: &Self) -> Self; fn sub(&self, other: &Self) -> Self; fn mul(&self, other: &Self) -> Self; fn div(&self, other: &Self) -> Self; fn rem(&self, other: &Self) -> Self; fn neg(&self) -> Self; fn abs(&self) -> Self; fn min(&self, other: &Self) -> Self; fn max(&self, other: &Self) -> Self; fn clamp(&self, min: &Self, max: &Self) -> Self;
}
Expand description

Core trait for vector types (basic operations).

Parameterised by element type T: Scalar and lane width N.

Required Methods§

Source

fn splat(value: T) -> Self

Construct a vector with all lanes set to the same value.

Source

fn load(slice: &[T]) -> Self

Load a vector from a slice (panics if slice is too short).

Source

fn store(&self, slice: &mut [T])

Store the vector lanes into a slice.

Source

fn extract(&self, index: usize) -> T

Extract the value at the given lane index.

Source

fn insert(&self, index: usize, value: T) -> Self

Return a new vector with the value at the given lane replaced.

Source

fn add(&self, other: &Self) -> Self

Lane-wise addition.

Source

fn sub(&self, other: &Self) -> Self

Lane-wise subtraction.

Source

fn mul(&self, other: &Self) -> Self

Lane-wise multiplication.

Source

fn div(&self, other: &Self) -> Self

Lane-wise division.

Source

fn rem(&self, other: &Self) -> Self

Lane-wise remainder.

Source

fn neg(&self) -> Self

Lane-wise negation.

Source

fn abs(&self) -> Self

Lane-wise absolute value.

Source

fn min(&self, other: &Self) -> Self

Lane-wise minimum.

Source

fn max(&self, other: &Self) -> Self

Lane-wise maximum.

Source

fn clamp(&self, min: &Self, max: &Self) -> Self

Lane-wise clamp to the inclusive range [min, max].

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<f32, 4> for F32x4

Source§

impl<T> Vector<T, 1> for ScalarVector1<T>
where T: Scalar,

Source§

impl<T> Vector<T, 2> for ScalarVector2<T>
where T: Scalar,

Source§

impl<T> Vector<T, 4> for ScalarVector4<T>
where T: Scalar,