pub struct Vector<T, const N: usize> { /* private fields */ }Expand description
Vector of fixed size.
Implementations§
Source§impl<T, const N: usize> Vector<T, N>
impl<T, const N: usize> Vector<T, N>
Sourcepub fn uninit() -> Vector<MaybeUninit<T>, N>
pub fn uninit() -> Vector<MaybeUninit<T>, N>
Create a vector with uninitialized content.
Source§impl<T, const N: usize> Vector<MaybeUninit<T>, N>
impl<T, const N: usize> Vector<MaybeUninit<T>, N>
Sourcepub unsafe fn assume_init(self) -> Vector<T, N>
pub unsafe fn assume_init(self) -> Vector<T, N>
Assume that vector content is initialized.
Source§impl<T, const N: usize> Vector<T, N>
impl<T, const N: usize> Vector<T, N>
Sourcepub fn from_array(array: [T; N]) -> Self
pub fn from_array(array: [T; N]) -> Self
Create from array.
Sourcepub fn into_array(self) -> [T; N]
pub fn into_array(self) -> [T; N]
Convert to array.
Sourcepub fn as_mut_array(&mut self) -> &mut [T; N]
pub fn as_mut_array(&mut self) -> &mut [T; N]
Get a mutable reference to underlying array.
Source§impl<T, const N: usize> Vector<T, N>
impl<T, const N: usize> Vector<T, N>
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Get mutable pointer to the first element.
Sourcepub unsafe fn get_unchecked(&self, i: usize) -> &T
pub unsafe fn get_unchecked(&self, i: usize) -> &T
Get reference to the elements without boundary checking.
Sourcepub unsafe fn get_unchecked_mut(&mut self, i: usize) -> &mut T
pub unsafe fn get_unchecked_mut(&mut self, i: usize) -> &mut T
Get mutable reference to the elements without boundary checking.
Source§impl<T, const N: usize> Vector<T, N>
impl<T, const N: usize> Vector<T, N>
Sourcepub fn try_from_iter<I>(iter: I) -> Option<Self>where
I: Iterator<Item = T>,
pub fn try_from_iter<I>(iter: I) -> Option<Self>where
I: Iterator<Item = T>,
Try to conctruct a vector from iterator.
If iterator conatains less items than vector, then Err is returned.
Source§impl<T, const N: usize> Vector<T, N>
impl<T, const N: usize> Vector<T, N>
Source§impl<T, const N: usize> Vector<T, N>
impl<T, const N: usize> Vector<T, N>
pub fn sum(self) -> Twhere
T: Add<Output = T>,
pub fn max(self) -> Twhere
T: PartialOrd,
pub fn min(self) -> Twhere
T: PartialOrd,
Source§impl<T, const N: usize> Vector<T, N>where
T: PartialOrd,
impl<T, const N: usize> Vector<T, N>where
T: PartialOrd,
Source§impl<T> Vector<T, 2>
impl<T> Vector<T, 2>
pub fn from_tuple((x, y): (T, T)) -> Self
pub fn into_tuple(self) -> (T, T)
Source§impl<T> Vector<T, 3>
impl<T> Vector<T, 3>
pub fn from_tuple((x, y, z): (T, T, T)) -> Self
pub fn into_tuple(self) -> (T, T, T)
Source§impl<T> Vector<T, 4>
impl<T> Vector<T, 4>
pub fn from_tuple((x, y, z, w): (T, T, T, T)) -> Self
pub fn into_tuple(self) -> (T, T, T, T)
Source§impl<T: Float, const N: usize> Vector<T, N>
impl<T: Float, const N: usize> Vector<T, N>
pub fn abs(self) -> Self
pub fn abs_sub<B: Broadcast<Self>>(self, other: B) -> Self
pub fn signum(self) -> Self
pub fn cbrt(self) -> Self
pub fn sqrt(self) -> Self
pub fn vmin<B: Broadcast<Self>>(self, other: B) -> Self
pub fn vmax<B: Broadcast<Self>>(self, other: B) -> Self
pub fn clamp<A: Broadcast<Self>, B: Broadcast<Self>>(self, a: A, b: B) -> Self
pub fn acos(self) -> Self
pub fn asin(self) -> Self
pub fn atan(self) -> Self
pub fn atan2<B: Broadcast<Self>>(self, other: B) -> Self
pub fn cosh(self) -> Self
pub fn hypot<B: Broadcast<Self>>(self, other: B) -> Self
pub fn sinh(self) -> Self
pub fn tan(self) -> Self
pub fn tanh(self) -> Self
pub fn log2(self) -> Self
pub fn mul_add<A: Broadcast<Self>, B: Broadcast<Self>>(self, a: A, b: B) -> Self
pub fn exp(self) -> Self
pub fn powi<B: Broadcast<Vector<i32, N>>>(self, other: B) -> Self
pub fn ln(self) -> Self
pub fn powf<B: Broadcast<Self>>(self, other: B) -> Self
pub fn log<B: Broadcast<Self>>(self, other: B) -> Self
pub fn sin(self) -> Self
pub fn cos(self) -> Self
pub fn asinh(self) -> Self
pub fn acosh(self) -> Self
pub fn atanh(self) -> Self
pub fn floor(self) -> Self
pub fn ceil(self) -> Self
pub fn round(self) -> Self
pub fn trunc(self) -> Self
pub fn fract(self) -> Self
pub fn recip(self) -> Self
pub fn exp2(self) -> Self
pub fn log10(self) -> Self
pub fn sin_cos(self) -> (Self, Self)
pub fn exp_m1(self) -> Self
pub fn ln_1p(self) -> Self
Trait Implementations§
Source§impl<T, const N: usize> AbsDiffEq for Vector<T, N>
impl<T, const N: usize> AbsDiffEq for Vector<T, N>
Source§fn default_epsilon() -> Self::Epsilon
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
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
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.Source§impl<T, const N: usize> AddAssign for Vector<T, N>where
T: AddAssign,
impl<T, const N: usize> AddAssign for Vector<T, N>where
T: AddAssign,
Source§fn add_assign(&mut self, vec: Vector<T, N>)
fn add_assign(&mut self, vec: Vector<T, N>)
Performs the
+= operation. Read moreSource§impl<T, const N: usize> BitAndAssign for Vector<T, N>where
T: BitAndAssign,
impl<T, const N: usize> BitAndAssign for Vector<T, N>where
T: BitAndAssign,
Source§fn bitand_assign(&mut self, other: Vector<T, N>)
fn bitand_assign(&mut self, other: Vector<T, N>)
Performs the
&= operation. Read moreSource§impl<T, const N: usize> BitOrAssign for Vector<T, N>where
T: BitOrAssign,
impl<T, const N: usize> BitOrAssign for Vector<T, N>where
T: BitOrAssign,
Source§fn bitor_assign(&mut self, other: Vector<T, N>)
fn bitor_assign(&mut self, other: Vector<T, N>)
Performs the
|= operation. Read moreSource§impl<T, const N: usize> BitXorAssign for Vector<T, N>where
T: BitXorAssign,
impl<T, const N: usize> BitXorAssign for Vector<T, N>where
T: BitXorAssign,
Source§fn bitxor_assign(&mut self, other: Vector<T, N>)
fn bitxor_assign(&mut self, other: Vector<T, N>)
Performs the
^= operation. Read moreSource§impl<T> Directional<Vector<T, 2>> for Rotation2<T>
impl<T> Directional<Vector<T, 2>> for Rotation2<T>
Source§impl<T> Directional<Vector<T, 3>> for Rotation3<T>
impl<T> Directional<Vector<T, 3>> for Rotation3<T>
Source§impl<T, const N: usize> Directional<Vector<T, N>> for Linear<T, N>
impl<T, const N: usize> Directional<Vector<T, N>> for Linear<T, N>
Source§impl<T, const N: usize> Directional<Vector<T, N>> for Scale<T>
impl<T, const N: usize> Directional<Vector<T, N>> for Scale<T>
Source§impl<T, const N: usize> Directional<Vector<T, N>> for Shift<T, N>
impl<T, const N: usize> Directional<Vector<T, N>> for Shift<T, N>
Source§impl<T: Float, const N: usize> Distribution<Vector<T, N>> for NonZero
impl<T: Float, const N: usize> Distribution<Vector<T, N>> for NonZero
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>
Generate a random value of
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
Create an iterator that generates random values of
T, using rng as
the source of randomness. Read moreSource§impl<T, const N: usize> Distribution<Vector<T, N>> for Normalwhere
Normal: Distribution<T>,
impl<T, const N: usize> Distribution<Vector<T, N>> for Normalwhere
Normal: Distribution<T>,
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>
Generate a random value of
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
Create an iterator that generates random values of
T, using rng as
the source of randomness. Read moreSource§impl<T: Float, const N: usize> Distribution<Vector<T, N>> for Unit
impl<T: Float, const N: usize> Distribution<Vector<T, N>> for Unit
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>
Generate a random value of
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
Create an iterator that generates random values of
T, using rng as
the source of randomness. Read moreSource§impl<D: Distribution<T>, T, const N: usize> Distribution<Vector<T, N>> for VectorDistribution<D, T, N>
impl<D: Distribution<T>, T, const N: usize> Distribution<Vector<T, N>> for VectorDistribution<D, T, N>
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector<T, N>
Generate a random value of
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
Create an iterator that generates random values of
T, using rng as
the source of randomness. Read moreSource§impl<T, const N: usize> DivAssign<T> for Vector<T, N>
impl<T, const N: usize> DivAssign<T> for Vector<T, N>
Source§fn div_assign(&mut self, a: T)
fn div_assign(&mut self, a: T)
Performs the
/= operation. Read moreSource§impl<T, const N: usize> DivAssign for Vector<T, N>where
T: DivAssign,
impl<T, const N: usize> DivAssign for Vector<T, N>where
T: DivAssign,
Source§fn div_assign(&mut self, vec: Vector<T, N>)
fn div_assign(&mut self, vec: Vector<T, N>)
Performs the
/= operation. Read moreSource§impl<'a, T, const M: usize, const N: usize> From<&'a Matrix<T, M, N>> for &'a Vector<Vector<T, N>, M>
impl<'a, T, const M: usize, const N: usize> From<&'a Matrix<T, M, N>> for &'a Vector<Vector<T, N>, M>
Source§impl<T, const M: usize, const N: usize> From<&Vector<Vector<T, N>, M>> for Matrix<T, M, N>where
T: Copy,
impl<T, const M: usize, const N: usize> From<&Vector<Vector<T, N>, M>> for Matrix<T, M, N>where
T: Copy,
Source§impl<'a, T, const M: usize, const N: usize> From<&'a mut Matrix<T, M, N>> for &'a mut Vector<Vector<T, N>, M>
impl<'a, T, const M: usize, const N: usize> From<&'a mut Matrix<T, M, N>> for &'a mut Vector<Vector<T, N>, M>
Source§impl<T> From<(T, T, T, T)> for Vector<T, 4>
impl<T> From<(T, T, T, T)> for Vector<T, 4>
Source§fn from(tuple: (T, T, T, T)) -> Self
fn from(tuple: (T, T, T, T)) -> Self
Converts to this type from the input type.
Source§impl<T> From<Vector<T, 4>> for (T, T, T, T)
impl<T> From<Vector<T, 4>> for (T, T, T, T)
Source§impl<T> From<Vector<T, 4>> for Quaternion<T>
impl<T> From<Vector<T, 4>> for Quaternion<T>
Source§impl<'a, T, const N: usize> IntoIterator for &'a Vector<T, N>
impl<'a, T, const N: usize> IntoIterator for &'a Vector<T, N>
Source§impl<'a, T, const N: usize> IntoIterator for &'a mut Vector<T, N>
impl<'a, T, const N: usize> IntoIterator for &'a mut Vector<T, N>
Source§impl<T, const N: usize> IntoIterator for Vector<T, N>
impl<T, const N: usize> IntoIterator for Vector<T, N>
Source§impl<T, const N: usize> MulAssign<T> for Vector<T, N>
impl<T, const N: usize> MulAssign<T> for Vector<T, N>
Source§fn mul_assign(&mut self, a: T)
fn mul_assign(&mut self, a: T)
Performs the
*= operation. Read moreSource§impl<T, const N: usize> MulAssign for Vector<T, N>where
T: MulAssign,
impl<T, const N: usize> MulAssign for Vector<T, N>where
T: MulAssign,
Source§fn mul_assign(&mut self, vec: Vector<T, N>)
fn mul_assign(&mut self, vec: Vector<T, N>)
Performs the
*= operation. Read moreSource§impl<T, const N: usize> RemAssign<T> for Vector<T, N>
impl<T, const N: usize> RemAssign<T> for Vector<T, N>
Source§fn rem_assign(&mut self, a: T)
fn rem_assign(&mut self, a: T)
Performs the
%= operation. Read moreSource§impl<T, const N: usize> RemAssign for Vector<T, N>where
T: RemAssign,
impl<T, const N: usize> RemAssign for Vector<T, N>where
T: RemAssign,
Source§fn rem_assign(&mut self, vec: Vector<T, N>)
fn rem_assign(&mut self, vec: Vector<T, N>)
Performs the
%= operation. Read moreSource§impl<T, const N: usize> SubAssign for Vector<T, N>where
T: SubAssign,
impl<T, const N: usize> SubAssign for Vector<T, N>where
T: SubAssign,
Source§fn sub_assign(&mut self, vec: Vector<T, N>)
fn sub_assign(&mut self, vec: Vector<T, N>)
Performs the
-= operation. Read moreSource§impl<T> Transform<Vector<T, 2>> for Rotation2<T>
impl<T> Transform<Vector<T, 2>> for Rotation2<T>
Source§impl<T> Transform<Vector<T, 3>> for Rotation3<T>
impl<T> Transform<Vector<T, 3>> for Rotation3<T>
Source§impl<T, const N: usize> Transform<Vector<T, N>> for Linear<T, N>
impl<T, const N: usize> Transform<Vector<T, N>> for Linear<T, N>
Source§impl<T, const N: usize> Transform<Vector<T, N>> for Scale<T>
impl<T, const N: usize> Transform<Vector<T, N>> for Scale<T>
Source§impl<T, const N: usize> Transform<Vector<T, N>> for Shift<T, N>
impl<T, const N: usize> Transform<Vector<T, N>> for Shift<T, N>
impl<T: Copy, const N: usize> Copy for Vector<T, N>
impl<T, const N: usize> StructuralPartialEq for Vector<T, N>
Auto Trait Implementations§
impl<T, const N: usize> Freeze for Vector<T, N>where
T: Freeze,
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more