Struct vecmat::Vector[][src]

#[repr(transparent)]pub struct Vector<T, const N: usize> { /* fields omitted */ }

Vector of fixed size.

Implementations

impl<T, const N: usize> Vector<T, N>[src]

pub fn uninit() -> Vector<MaybeUninit<T>, N>[src]

Create a vector with uninitialized content.

impl<T, const N: usize> Vector<MaybeUninit<T>, N>[src]

pub unsafe fn assume_init(self) -> Vector<T, N>[src]

Assume that vector content is initialized.

impl<T, const N: usize> Vector<T, N>[src]

pub fn init<F: FnMut() -> T>(f: F) -> Self[src]

Initialize a vector with values from closure.

impl<T, const N: usize> Vector<T, N> where
    T: Default
[src]

pub fn new() -> Self[src]

Create default vector.

impl<T, const N: usize> Vector<T, N> where
    T: Copy
[src]

pub fn fill(v: T) -> Self[src]

Create vector which elements are filled with scalar value.

impl<T, const N: usize> Vector<T, N>[src]

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

Create from array.

pub fn into_array(self) -> [T; N][src]

Convert to array.

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

Get a reference to underlying array.

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

Get a mutable reference to underlying array.

impl<T, const N: usize> Vector<T, N>[src]

pub fn as_ptr(&self) -> *const T[src]

Get pointer to the first element.

pub fn as_mut_ptr(&mut self) -> *mut T[src]

Get mutable pointer to the first element.

pub unsafe fn get_unchecked(&self, i: usize) -> &T[src]

Get reference to the elements without boundary checking.

pub unsafe fn get_unchecked_mut(&mut self, i: usize) -> &mut T[src]

Get mutable reference to the elements without boundary checking.

impl<T, const N: usize> Vector<T, N>[src]

pub fn iter(&self) -> Iter<'_, T>[src]

Returns iterator over vector element refrences.

pub fn iter_mut(&mut self) -> IterMut<'_, T>[src]

Returns iterator over vector element mutable refrences.

impl<T, const N: usize> Vector<T, N>[src]

pub fn try_from_iter<I>(iter: I) -> Option<Self> where
    I: Iterator<Item = T>, 
[src]

Try to conctruct a vector from iterator. If iterator conatains less items than vector, then Err is returned.

impl<const N: usize> Vector<usize, N>[src]

pub fn indices() -> Self[src]

Create vector which element value equals to its position in vector.

impl<T, const N: usize> Vector<T, N>[src]

pub fn for_each<F: FnMut(T)>(self, f: F)[src]

Call closure for each element of the vector passing it by value.

pub fn map<U, F: FnMut(T) -> U>(self, f: F) -> Vector<U, N>[src]

Map vector elements.

pub fn zip<U>(self, other: Vector<U, N>) -> Vector<(T, U), N>[src]

Zip two vectors into one.

pub fn enumerate(self) -> Vector<(usize, T), N>[src]

Enumerate vector elements.

impl<T, U, const N: usize> Vector<(T, U), N>[src]

pub fn unzip(self) -> (Vector<T, N>, Vector<U, N>)[src]

Unzip vector of tuples into two vectors.

impl<T, const N: usize> Vector<T, N>[src]

pub fn fold<S, F: FnMut(S, T) -> S>(self, s: S, f: F) -> S[src]

pub fn fold_first<F: FnMut(T, T) -> T>(self, f: F) -> T[src]

pub fn scan<S, U, F: FnMut(&mut S, T) -> U>(self, s: S, f: F) -> Vector<U, N>[src]

impl<T, const N: usize> Vector<T, N> where
    T: Add<Output = T> + Mul<Output = T> + Copy
[src]

pub fn square_length(self) -> T[src]

impl<T, const N: usize> Vector<T, N> where
    T: Float
[src]

pub fn length(self) -> T[src]

pub fn normalize(self) -> Vector<T, N>[src]

impl<T, const N: usize> Vector<T, N>[src]

pub fn sum(self) -> T where
    T: Add<Output = T>, 
[src]

pub fn max(self) -> T where
    T: PartialOrd
[src]

pub fn min(self) -> T where
    T: PartialOrd
[src]

impl<const N: usize> Vector<bool, N>[src]

pub fn any(self) -> bool[src]

impl<const N: usize> Vector<bool, N>[src]

pub fn all(self) -> bool[src]

impl<T, const N: usize> Vector<T, N> where
    T: Integer
[src]

pub fn div_floor(self, other: Vector<T, N>) -> Vector<T, N>[src]

pub fn mod_floor(self, other: Vector<T, N>) -> Vector<T, N>[src]

pub fn div_mod_floor(self, other: Vector<T, N>) -> (Vector<T, N>, Vector<T, N>)[src]

impl<T, const N: usize> Vector<T, N> where
    T: PartialEq
[src]

pub fn veq(self, other: Vector<T, N>) -> Vector<bool, N>[src]

pub fn vne(self, other: Vector<T, N>) -> Vector<bool, N>[src]

impl<T, const N: usize> Vector<T, N> where
    T: PartialOrd
[src]

pub fn vlt(self, other: Vector<T, N>) -> Vector<bool, N>[src]

pub fn vle(self, other: Vector<T, N>) -> Vector<bool, N>[src]

pub fn vgt(self, other: Vector<T, N>) -> Vector<bool, N>[src]

pub fn vge(self, other: Vector<T, N>) -> Vector<bool, N>[src]

impl<T> Vector<T, 2> where
    T: Copy
[src]

pub fn x(&self) -> T[src]

pub fn y(&self) -> T[src]

impl<T> Vector<T, 3> where
    T: Copy
[src]

pub fn x(&self) -> T[src]

pub fn y(&self) -> T[src]

pub fn z(&self) -> T[src]

impl<T> Vector<T, 4> where
    T: Copy
[src]

pub fn x(&self) -> T[src]

pub fn y(&self) -> T[src]

pub fn z(&self) -> T[src]

pub fn w(&self) -> T[src]

impl<T> Vector<T, 2>[src]

pub fn x_ref(&self) -> &T[src]

pub fn y_ref(&self) -> &T[src]

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

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

impl<T> Vector<T, 3>[src]

pub fn x_ref(&self) -> &T[src]

pub fn y_ref(&self) -> &T[src]

pub fn z_ref(&self) -> &T[src]

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

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

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

impl<T> Vector<T, 4>[src]

pub fn x_ref(&self) -> &T[src]

pub fn y_ref(&self) -> &T[src]

pub fn z_ref(&self) -> &T[src]

pub fn w_ref(&self) -> &T[src]

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

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

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

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

impl<T> Vector<T, 2> where
    T: Mul<Output = T> + Sub<Output = T> + Copy
[src]

pub fn cross(self, other: Vector<T, 2>) -> T[src]

Pseudo-cross product for 2D vector.

impl<T> Vector<T, 3> where
    T: Mul<Output = T> + Sub<Output = T> + Copy
[src]

pub fn cross(self, other: Vector<T, 3>) -> Vector<T, 3>[src]

Cross product.

impl<T> Vector<T, 4> where
    T: Mul<Output = T> + Sub<Output = T> + Zero + Copy
[src]

pub fn cross(self, other: Vector<T, 4>) -> Vector<T, 4>[src]

Cross product of first three components, fourth one is set to zero.

impl<T> Vector<T, 2>[src]

pub fn from_tuple((x, y): (T, T)) -> Self[src]

pub fn into_tuple(self) -> (T, T)[src]

impl<T> Vector<T, 3>[src]

pub fn from_tuple((x, y, z): (T, T, T)) -> Self[src]

pub fn into_tuple(self) -> (T, T, T)[src]

impl<T> Vector<T, 4>[src]

pub fn from_tuple((x, y, z, w): (T, T, T, T)) -> Self[src]

pub fn into_tuple(self) -> (T, T, T, T)[src]

Trait Implementations

impl<T, const N: usize> AbsDiffEq<Vector<T, N>> for Vector<T, N> where
    T: AbsDiffEq<Epsilon = T> + Copy
[src]

type Epsilon = T

Used for specifying relative comparisons.

impl<T, const N: usize> Add<Vector<T, N>> for Vector<T, N> where
    T: Add<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the + operator.

impl<T, const N: usize> AddAssign<Vector<T, N>> for Vector<T, N> where
    T: AddAssign
[src]

impl<T, const N: usize> AsMut<[T; N]> for Vector<T, N>[src]

impl<T, const M: usize, const N: usize> AsMut<Vector<Vector<T, N>, M>> for Matrix<T, M, N>[src]

impl<T, const N: usize> AsRef<[T; N]> for Vector<T, N>[src]

impl<T, const M: usize, const N: usize> AsRef<Vector<Vector<T, N>, M>> for Matrix<T, M, N>[src]

impl<T, const N: usize> BitAnd<Vector<T, N>> for Vector<T, N> where
    T: BitAnd<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the & operator.

impl<T, const N: usize> BitAndAssign<Vector<T, N>> for Vector<T, N> where
    T: BitAndAssign
[src]

impl<T, const N: usize> BitOr<Vector<T, N>> for Vector<T, N> where
    T: BitOr<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the | operator.

impl<T, const N: usize> BitOrAssign<Vector<T, N>> for Vector<T, N> where
    T: BitOrAssign
[src]

impl<T, const N: usize> BitXor<Vector<T, N>> for Vector<T, N> where
    T: BitXor<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the ^ operator.

impl<T, const N: usize> BitXorAssign<Vector<T, N>> for Vector<T, N> where
    T: BitXorAssign
[src]

impl<T: Clone, const N: usize> Clone for Vector<T, N>[src]

impl<T: Copy, const N: usize> Copy for Vector<T, N>[src]

impl<T, const N: usize> Debug for Vector<T, N> where
    T: Debug
[src]

impl<T, const N: usize> Default for Vector<T, N> where
    T: Default
[src]

fn default() -> Self[src]

Create vector filled with default values.

impl<T, const N: usize> Display for Vector<T, N> where
    T: Display
[src]

impl<D: Distribution<T>, T, const N: usize> Distribution<Vector<T, N>> for VectorDistribution<D, T, N>[src]

impl<T, const N: usize> Distribution<Vector<T, N>> for Normal where
    Normal: Distribution<T>, 
[src]

impl<T: Float, const N: usize> Distribution<Vector<T, N>> for NonZero where
    Normal: Distribution<Vector<T, N>>, 
[src]

impl<T: Float, const N: usize> Distribution<Vector<T, N>> for Unit where
    NonZero: Distribution<Vector<T, N>>, 
[src]

impl<T, const N: usize> Div<T> for Vector<T, N> where
    T: Div<Output = T> + Copy
[src]

type Output = Vector<T, N>

The resulting type after applying the / operator.

impl<T, const N: usize> Div<Vector<T, N>> for Vector<T, N> where
    T: Div<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the / operator.

impl<T, const N: usize> DivAssign<T> for Vector<T, N> where
    T: DivAssign + Copy
[src]

impl<T, const N: usize> DivAssign<Vector<T, N>> for Vector<T, N> where
    T: DivAssign
[src]

impl<T, const M: usize, const N: usize> Dot<Matrix<T, M, N>> for Vector<T, M> where
    T: Mul<Output = T> + Add<Output = T> + Copy
[src]

type Output = Vector<T, N>

Dot product output type.

impl<T, const M: usize, const N: usize> Dot<Vector<T, N>> for Matrix<T, M, N> where
    T: Mul<Output = T> + Add<Output = T> + Copy
[src]

type Output = Vector<T, M>

Dot product output type.

impl<T, const N: usize> Dot<Vector<T, N>> for Vector<T, N> where
    T: Mul<Output = T> + Add<Output = T>, 
[src]

type Output = T

Dot product output type.

impl<T, const N: usize> From<&'_ [T; N]> for Vector<T, N> where
    T: Copy
[src]

impl<T, const M: usize, const N: usize> From<&'_ Vector<Vector<T, N>, M>> for Matrix<T, M, N> where
    T: Copy
[src]

impl<'a, T, const M: usize, const N: usize> From<&'a Matrix<T, M, N>> for &'a Vector<Vector<T, N>, M>[src]

impl<'a, T, const M: usize, const N: usize> From<&'a mut Matrix<T, M, N>> for &'a mut Vector<Vector<T, N>, M>[src]

impl<T, const N: usize> From<[T; N]> for Vector<T, N>[src]

impl<T> From<(T, T, T, T)> for Vector<T, 4>[src]

impl<T> From<(T, T, T)> for Vector<T, 3>[src]

impl<T> From<(T, T)> for Vector<T, 2>[src]

impl<T, const M: usize, const N: usize> From<Matrix<T, M, N>> for Vector<Vector<T, N>, M>[src]

impl<T, const N: usize> From<Shift<T, N>> for Vector<T, N>[src]

impl<T> From<Vector<T, 2_usize>> for Complex<T>[src]

impl<T> From<Vector<T, 4_usize>> for Quaternion<T>[src]

impl<T, const N: usize> From<Vector<T, N>> for Shift<T, N>[src]

impl<T, const M: usize, const N: usize> From<Vector<Vector<T, N>, M>> for Matrix<T, M, N>[src]

impl<T, const N: usize> Index<usize> for Vector<T, N>[src]

type Output = T

The returned type after indexing.

impl<T, const N: usize> IndexMut<usize> for Vector<T, N>[src]

impl<T, const N: usize> IntoIterator for Vector<T, N>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T, N>

Which kind of iterator are we turning this into?

impl<'a, T, const N: usize> IntoIterator for &'a Vector<T, N>[src]

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?

impl<'a, T, const N: usize> IntoIterator for &'a mut Vector<T, N>[src]

type Item = &'a mut T

The type of the elements being iterated over.

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?

impl<T, const N: usize> Mul<T> for Vector<T, N> where
    T: Mul<Output = T> + Copy
[src]

type Output = Vector<T, N>

The resulting type after applying the * operator.

impl<T, const N: usize> Mul<Vector<T, N>> for Vector<T, N> where
    T: Mul<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the * operator.

impl<T, const N: usize> MulAssign<T> for Vector<T, N> where
    T: MulAssign + Copy
[src]

impl<T, const N: usize> MulAssign<Vector<T, N>> for Vector<T, N> where
    T: MulAssign
[src]

impl<T, const N: usize> Neg for Vector<T, N> where
    T: Neg<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the - operator.

impl<T, const N: usize> NormL1 for Vector<T, N> where
    T: NormL1<Output = T> + Add<Output = T>, 
[src]

type Output = T

Type of the norm.

impl<T, const N: usize> NormL2 for Vector<T, N> where
    T: Float
[src]

type Output = T

Type of the norm.

impl<T, const N: usize> NormLInf for Vector<T, N> where
    T: NormLInf<Output = T> + PartialOrd
[src]

type Output = T

Type of the norm.

impl<T, const N: usize> Not for Vector<T, N> where
    T: Not<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the ! operator.

impl<T, const M: usize, const N: usize> Outer<Vector<T, N>> for Vector<T, M> where
    T: Mul<Output = T> + Copy
[src]

type Output = Matrix<T, M, N>

Outer product output type.

impl<T: PartialEq, const N: usize> PartialEq<Vector<T, N>> for Vector<T, N>[src]

impl<T, const N: usize> Rem<T> for Vector<T, N> where
    T: Rem<Output = T> + Copy
[src]

type Output = Vector<T, N>

The resulting type after applying the % operator.

impl<T, const N: usize> Rem<Vector<T, N>> for Vector<T, N> where
    T: Rem<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the % operator.

impl<T, const N: usize> RemAssign<T> for Vector<T, N> where
    T: RemAssign + Copy
[src]

impl<T, const N: usize> RemAssign<Vector<T, N>> for Vector<T, N> where
    T: RemAssign
[src]

impl<T, const N: usize> StructuralPartialEq for Vector<T, N>[src]

impl<T, const N: usize> Sub<Vector<T, N>> for Vector<T, N> where
    T: Sub<Output = T>, 
[src]

type Output = Vector<T, N>

The resulting type after applying the - operator.

impl<T, const N: usize> SubAssign<Vector<T, N>> for Vector<T, N> where
    T: SubAssign
[src]

impl<'a, T, const N: usize> TryFrom<&'a [T]> for Vector<T, N> where
    T: Copy
[src]

type Error = ()

The type returned in the event of a conversion error.

impl<T, const N: usize> Zero for Vector<T, N> where
    T: Zero
[src]

Auto Trait Implementations

impl<T, const N: usize> RefUnwindSafe for Vector<T, N> where
    T: RefUnwindSafe

impl<T, const N: usize> Send for Vector<T, N> where
    T: Send

impl<T, const N: usize> Sync for Vector<T, N> where
    T: Sync

impl<T, const N: usize> Unpin for Vector<T, N> where
    T: Unpin

impl<T, const N: usize> UnwindSafe for Vector<T, N> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

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>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,