Vector

Struct Vector 

Source
pub struct Vector<E, const LEN: usize>(pub [E; LEN])
where
    E: MatEl;
Expand description

A vector structure.

Tuple Fields§

§0: [E; LEN]

Implementations§

Source§

impl<E, const N: usize> Vector<E, N>
where E: MatEl,

Source

pub const fn splat(v: E) -> Self

Creates a vector from a single value : [ v ; N ]

Source

pub fn to_array(&self) -> [E; N]

Return underlying array data

Source

pub fn from_array(src: [E; N]) -> Self

Creates vector from given raw array

Source

pub fn from_slice(src: &[E]) -> Self

Creates vector from given raw slice. Assumes slice’s length is equal to vector size

§Panics

Panics if src lenght does not match vector size

Source§

impl<E: MatEl + NdFloat, const LEN: usize> Vector<E, LEN>

Source

pub fn normalize(self) -> Self

Normalizes the vector

Source

pub fn mag(&self) -> E

Compute the length of the vector

Source

pub fn mag2(&self) -> E

Computer the squared length of the vector

Source

pub fn min(self, rhs: Self) -> Self

Compute a vector, whose elements are minimum of both vectors: r[ i ] = a[ i ].min( b [ i ] )

Source

pub fn max(self, rhs: Self) -> Self

Compute a vector, whose elements are maximum of both vectors: r[ i ] = a[ i ].max( b [ i ] )

Source

pub fn distance(&self, rhs: &Self) -> E

Computes length of the vector between two points in space

Source

pub fn distance_squared(&self, rhs: &Self) -> E

Computes squared length of the vector between two points in space

Source

pub fn dot(&self, rhs: &Self) -> E

Computes the dot product of two vectors

Source§

impl<E> Vector<E, 2>
where E: MatEl + NdFloat,

Source

pub const fn new(x: E, y: E) -> Self

Create a new vector

Source

pub fn x(&self) -> E

The x component of vector

Source

pub fn y(&self) -> E

The y component of vector

Source§

impl Vector<f32, 2>

Source

pub const X: Self

Unit x vector

Source

pub const Y: Self

Unit y vector

Source

pub const NEG_X: Self

Minus unit x vector

Source

pub const NEG_Y: Self

Minus unit y vector

Source

pub const MIN: Self

All elements are f32::MIN

Source

pub const MAX: Self

All elements are f32::MAX

Source

pub const ZERO: Self

All elemets are ZERO

Source§

impl<E> Vector<E, 3>
where E: MatEl + NdFloat,

Source

pub const fn new(x: E, y: E, z: E) -> Self

Create a new vector

Source

pub fn x(&self) -> E

The x component of vector

Source

pub fn y(&self) -> E

The y component of vector

Source

pub fn z(&self) -> E

The z component of vector

Source

pub fn cross(self, rhs: Self) -> Self

Calculates cross product with another vector

Source

pub fn to_homogenous(self) -> Vector<E, 4>

Creates homogeneous vector from self

Source§

impl Vector<f32, 3>

Source

pub const X: Self

Unit x vector

Source

pub const Y: Self

Unit y vector

Source

pub const Z: Self

Unit z vector

Source

pub const NEG_X: Self

Minus unit x vector

Source

pub const NEG_Y: Self

Minus unit y vector

Source

pub const NEG_Z: Self

Minus unit z vector

Source

pub const MIN: Self

All elements are f32::MIN

Source

pub const MAX: Self

All elements are f32::MAX

Source

pub const ZERO: Self

All elemets are ZERO

Source§

impl<E> Vector<E, 4>
where E: MatEl + NdFloat,

Source

pub const fn new(x: E, y: E, z: E, w: E) -> Self

Create a new vector

Source

pub fn x(&self) -> E

The x component of vector

Source

pub fn y(&self) -> E

The y component of vector

Source

pub fn z(&self) -> E

The z component of vector

Source

pub fn w(&self) -> E

The w component of vector

Source

pub fn truncate(&self) -> Vector<E, 3>

Truncates w component of a vector creating vector of 3 elements

Source§

impl Vector<f32, 4>

Source

pub const X: Self

Unit x vector

Source

pub const Y: Self

Unit y vector

Source

pub const Z: Self

Unit z vector

Source

pub const W: Self

Unit w vector

Source

pub const NEG_X: Self

Minus unit x vector

Source

pub const NEG_Y: Self

Minus unit y vector

Source

pub const NEG_Z: Self

Minus unit z vector

Source

pub const NEG_W: Self

Minus unit w vector

Source

pub const MIN: Self

All elements are f32::MIN

Source

pub const MAX: Self

All elements are f32::MAX

Source

pub const ZERO: Self

All elemets are ZERO

Methods from Deref<Target = [E; N]>§

1.57.0 · Source

pub fn as_slice(&self) -> &[T]

Returns a slice containing the entire array. Equivalent to &s[..].

1.57.0 · Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Returns a mutable slice containing the entire array. Equivalent to &mut s[..].

1.77.0 · Source

pub fn each_ref(&self) -> [&T; N]

Borrows each element and returns an array of references with the same size as self.

§Example
let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);

This method is particularly useful if combined with other methods, like map. This way, you can avoid moving the original array if its elements are not Copy.

let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);

// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);
1.77.0 · Source

pub fn each_mut(&mut self) -> [&mut T; N]

Borrows each element mutably and returns an array of mutable references with the same size as self.

§Example

let mut floats = [3.1, 2.7, -1.0];
let float_refs: [&mut f64; 3] = floats.each_mut();
*float_refs[0] = 0.0;
assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]);
assert_eq!(floats, [0.0, 2.7, -1.0]);
Source

pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])

🔬This is a nightly-only experimental API. (split_array)

Divides one array reference into two at an index.

The first will contain all indices from [0, M) (excluding the index M itself) and the second will contain all indices from [M, N) (excluding the index N itself).

§Panics

Panics if M > N.

§Examples
#![feature(split_array)]

let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.split_array_ref::<0>();
   assert_eq!(left, &[]);
   assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}

{
    let (left, right) = v.split_array_ref::<2>();
    assert_eq!(left, &[1, 2]);
    assert_eq!(right, &[3, 4, 5, 6]);
}

{
    let (left, right) = v.split_array_ref::<6>();
    assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
    assert_eq!(right, &[]);
}
Source

pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])

🔬This is a nightly-only experimental API. (split_array)

Divides one mutable array reference into two at an index.

The first will contain all indices from [0, M) (excluding the index M itself) and the second will contain all indices from [M, N) (excluding the index N itself).

§Panics

Panics if M > N.

§Examples
#![feature(split_array)]

let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.split_array_mut::<2>();
assert_eq!(left, &mut [1, 0][..]);
assert_eq!(right, &mut [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);
Source

pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])

🔬This is a nightly-only experimental API. (split_array)

Divides one array reference into two at an index from the end.

The first will contain all indices from [0, N - M) (excluding the index N - M itself) and the second will contain all indices from [N - M, N) (excluding the index N itself).

§Panics

Panics if M > N.

§Examples
#![feature(split_array)]

let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.rsplit_array_ref::<0>();
   assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
   assert_eq!(right, &[]);
}

{
    let (left, right) = v.rsplit_array_ref::<2>();
    assert_eq!(left, &[1, 2, 3, 4]);
    assert_eq!(right, &[5, 6]);
}

{
    let (left, right) = v.rsplit_array_ref::<6>();
    assert_eq!(left, &[]);
    assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
Source

pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])

🔬This is a nightly-only experimental API. (split_array)

Divides one mutable array reference into two at an index from the end.

The first will contain all indices from [0, N - M) (excluding the index N - M itself) and the second will contain all indices from [N - M, N) (excluding the index N itself).

§Panics

Panics if M > N.

§Examples
#![feature(split_array)]

let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.rsplit_array_mut::<4>();
assert_eq!(left, &mut [1, 0]);
assert_eq!(right, &mut [3, 0, 5, 6][..]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);

Trait Implementations§

Source§

impl<E, const SIZE: usize> AbsDiffEq for Vector<E, SIZE>
where E: AbsDiffEq + MatEl, E::Epsilon: Copy,

Source§

type Epsilon = <[E] as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
Source§

impl<E, const LEN: usize> Add<E> for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: E) -> Self::Output

Performs the + operation. Read more
Source§

impl<E, const LEN: usize> Add for &Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<E, const LEN: usize> Add for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<E, const LEN: usize> AddAssign for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<E, const N: usize> ArrayMut<E, N> for Vector<E, N>
where E: MatEl,

Source§

fn vector_mut(&mut self) -> &mut [E; N]

Returns a mutable reference to a fixed-size array from the collection. Read more
Source§

impl<E, const N: usize> ArrayRef<E, N> for Vector<E, N>
where E: MatEl,

Source§

fn array_ref(&self) -> &[E; N]

Returns a reference to a fixed-size array from the collection. Read more
Source§

impl<E, const LEN: usize> Clone for Vector<E, LEN>
where E: MatEl + Clone,

Source§

fn clone(&self) -> Vector<E, LEN>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E, const N: usize> Collection for Vector<E, N>
where E: MatEl,

Source§

type Scalar = E

The scalar type contained in the collection.
Source§

impl<E, const N: usize> ConstLength for Vector<E, N>
where E: MatEl,

Source§

const LEN: usize = N

The length of the entity.
Source§

impl<E, const LEN: usize> Debug for Vector<E, LEN>
where E: MatEl + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E, const N: usize> Default for Vector<E, N>
where E: MatEl + Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<E, const N: usize> Deref for Vector<E, N>
where E: MatEl,

Source§

type Target = [E; N]

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<E, const N: usize> DerefMut for Vector<E, N>
where E: MatEl,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<E, const LEN: usize> Div<E> for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: E) -> Self::Output

Performs the / operation. Read more
Source§

impl<E, const LEN: usize> Div for Vector<E, LEN>
where E: MatEl + NdFloat + DivAssign,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<E, const LEN: usize> DivAssign<E> for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

fn div_assign(&mut self, rhs: E)

Performs the /= operation. Read more
Source§

impl<E, const LEN: usize> DivAssign for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<E: MatEl, const N: usize> From<[E; N]> for Vector<E, N>

Source§

fn from(value: [E; N]) -> Self

Converts to this type from the input type.
Source§

impl<E, Vec2> From<(Vec2, Vec2)> for Vector<E, 4>
where Vec2: VectorIter<E, 2>, E: MatEl,

Source§

fn from(value: (Vec2, Vec2)) -> Self

Converts to this type from the input type.
Source§

impl<E: MatEl, const N: usize> From<Vector<E, N>> for [E; N]

Source§

fn from(value: Vector<E, N>) -> Self

Converts to this type from the input type.
Source§

impl<E, const LEN: usize> Hash for Vector<E, LEN>
where E: MatEl + Hash,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<E, const N: usize> Index<usize> for Vector<E, N>
where E: MatEl,

Source§

type Output = E

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<E, const N: usize> IndexMut<usize> for Vector<E, N>
where E: MatEl,

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, E, const N: usize> IntoIterator for &'a Vector<E, N>
where E: MatEl,

Source§

type Item = &'a E

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, E>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, E, const N: usize> IntoIterator for &'a mut Vector<E, N>
where E: MatEl,

Source§

type Item = &'a mut E

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, E>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<E, const N: usize> IntoIterator for Vector<E, N>
where E: MatEl,

Source§

type Item = E

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<E, N>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<E, const ROWS: usize, const COLS: usize, Descriptor> Mul<&Vector<E, COLS>> for &Mat<ROWS, COLS, E, Descriptor>
where Descriptor: Descriptor, E: MatEl + NdFloat, Mat<ROWS, COLS, E, Descriptor>: Indexable<Index = Ix2> + IndexingRef<Scalar = E>,

Source§

type Output = Vector<E, COLS>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Vector<E, COLS>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E, const LEN: usize> Mul<E> for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: E) -> Self::Output

Performs the * operation. Read more
Source§

impl<E, const ROWS: usize, const COLS: usize, Descriptor> Mul<Vector<E, COLS>> for Mat<ROWS, COLS, E, Descriptor>
where Descriptor: Descriptor, E: MatEl + NdFloat, Mat<ROWS, COLS, E, Descriptor>: Indexable<Index = Ix2> + IndexingRef<Scalar = E>,

Source§

type Output = Vector<E, COLS>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vector<E, COLS>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const LEN: usize> Mul<Vector<f32, LEN>> for f32

Source§

type Output = Vector<f32, LEN>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vector<f32, LEN>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const LEN: usize> Mul<Vector<f64, LEN>> for f64

Source§

type Output = Vector<f64, LEN>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vector<f64, LEN>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E, const LEN: usize> Mul for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<E, const LEN: usize> MulAssign<E> for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

fn mul_assign(&mut self, rhs: E)

Performs the *= operation. Read more
Source§

impl<E, const ROWS: usize, const COLS: usize, Descriptor> MulAssign<Mat<ROWS, COLS, E, Descriptor>> for Vector<E, COLS>
where Descriptor: Descriptor, E: MatEl + NdFloat, Mat<ROWS, COLS, E, Descriptor>: Indexable<Index = Ix2> + IndexingRef<Scalar = E>,

Source§

fn mul_assign(&mut self, rhs: Mat<ROWS, COLS, E, Descriptor>)

Performs the *= operation. Read more
Source§

impl<E, const LEN: usize> Neg for &Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<E, const LEN: usize> Neg for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<E, const LEN: usize> PartialEq for Vector<E, LEN>
where E: MatEl + PartialEq,

Source§

fn eq(&self, other: &Vector<E, LEN>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E, const LEN: usize> PartialOrd for Vector<E, LEN>
where E: MatEl + PartialOrd,

Source§

fn partial_cmp(&self, other: &Vector<E, LEN>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<E, const SIZE: usize> RelativeEq for Vector<E, SIZE>
where E: RelativeEq + MatEl, E::Epsilon: Copy,

Source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of RelativeEq::relative_eq.
Source§

impl<E, const LEN: usize> Rem<E> for &Vector<E, LEN>
where E: MatEl + NdFloat + Rem<Output = E>,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the % operator.
Source§

fn rem(self, scalar: E) -> Self::Output

Performs the % operation. Read more
Source§

impl<E, const LEN: usize> Rem<E> for Vector<E, LEN>
where E: MatEl + NdFloat + Rem<Output = E>,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the % operator.
Source§

fn rem(self, scalar: E) -> Self::Output

Performs the % operation. Read more
Source§

impl<E, const LEN: usize> Rem for &Vector<E, LEN>
where E: MatEl + NdFloat + Rem<Output = E>,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl<E, const LEN: usize> Rem for Vector<E, LEN>
where E: MatEl + NdFloat + Rem<Output = E>,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl<E, const LEN: usize> RemAssign<E> for Vector<E, LEN>
where E: MatEl + NdFloat + Rem<Output = E>,

Source§

fn rem_assign(&mut self, scalar: E)

Performs the %= operation. Read more
Source§

impl<E, const LEN: usize> RemAssign for Vector<E, LEN>
where E: MatEl + NdFloat + Rem<Output = E>,

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<E, const LEN: usize> Sub<E> for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: E) -> Self::Output

Performs the - operation. Read more
Source§

impl<E, const LEN: usize> Sub for &Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<E, const LEN: usize> Sub for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

type Output = Vector<E, LEN>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<E, const LEN: usize> SubAssign for Vector<E, LEN>
where E: MatEl + NdFloat,

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<E, const N: usize> TryFrom<&[E]> for Vector<E, N>
where E: MatEl,

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

fn try_from(value: &[E]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<E, const SIZE: usize> UlpsEq for Vector<E, SIZE>
where E: UlpsEq + MatEl, E::Epsilon: Copy,

Source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
Source§

fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
Source§

impl<E, const N: usize> VectorIter<E, N> for Vector<E, N>
where E: MatEl,

Source§

fn vector_iter<'a>(&'a self) -> impl VectorIteratorRef<'a, &'a E>
where E: 'a,

Returns an iterator over references to the elements of the vector.
Source§

impl<E, const N: usize> VectorIterMut<E, N> for Vector<E, N>
where E: MatEl,

Source§

fn vector_iter_mut<'a>(&'a mut self) -> impl VectorIterator<'a, &'a mut E>
where E: 'a,

Returns an iterator over mutable references to the elements of the vector.
Source§

impl<E, const LEN: usize> Copy for Vector<E, LEN>
where E: MatEl + Copy,

Source§

impl<E, const LEN: usize> StructuralPartialEq for Vector<E, LEN>
where E: MatEl,

Auto Trait Implementations§

§

impl<E, const LEN: usize> Freeze for Vector<E, LEN>
where E: Freeze,

§

impl<E, const LEN: usize> RefUnwindSafe for Vector<E, LEN>
where E: RefUnwindSafe,

§

impl<E, const LEN: usize> Send for Vector<E, LEN>
where E: Send,

§

impl<E, const LEN: usize> Sync for Vector<E, LEN>
where E: Sync,

§

impl<E, const LEN: usize> Unpin for Vector<E, LEN>
where E: Unpin,

§

impl<E, const LEN: usize> UnwindSafe for Vector<E, LEN>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneDyn for T
where T: Clone,

Source§

fn __clone_dyn(&self, _: DontCallMe) -> *mut ()

Source§

impl<T> CloneDyn for T
where T: Clone,

Source§

fn __clone_dyn(&self, _: DontCallMe) -> *mut ()

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<E, V, const N: usize> DimOffset<N> for V
where V: Debug + ArrayRef<E, N> + Collection<Scalar = E, Scalar = E> + Collection + ?Sized, E: Mul<Output = E> + Add<Output = E> + PartialOrd + Copy + Default + From<u8>,

Source§

fn offset<V2>(&self, md_index: &V2) -> <V as Collection>::Scalar
where V2: ArrayRef<E, N> + Collection<Scalar = <V as Collection>::Scalar> + Debug + ?Sized,

Converts a multidimensional index into a flat offset. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<All> From1<()> for All
where All: Default,

Source§

fn from1(_a: ()) -> All

Constructor with a single arguments.
Source§

impl<T, All> From1<(T,)> for All
where All: From1<T>,

Source§

fn from1(arg: (T,)) -> All

Constructor with a single arguments.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<All, F> Into1<F> for All
where F: From1<All>,

Source§

fn to(self) -> F

Converts this type into the (usually inferred) input type.
Source§

impl<T> IntoResult<T> for T

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToRef<T> for T
where T: ?Sized,

Source§

fn to_ref(&self) -> &T

Converts the implementing type to an immutable reference. Read more
Source§

impl<T> ToValue<T> for T

Source§

fn to_value(self) -> T

Obtains the value from the implementing type. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> MatEl for T
where T: Copy + Default,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,