#[repr(transparent)]pub struct Vector<T, const D: usize> {
pub coords: [T; D],
}
Expand description
A static D
-dimensional vector, backed by a primitive array
.
Fields§
§coords: [T; D]
The vector coordinates in some basis.
Implementations§
Source§impl Vector<i8, 3>
§Methods for 3d vectors represented using i8
.
impl Vector<i8, 3>
§Methods for 3d vectors represented using i8
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl Vector<i16, 3>
§Methods for 3d vectors represented using i16
.
impl Vector<i16, 3>
§Methods for 3d vectors represented using i16
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl Vector<i32, 3>
§Methods for 3d vectors represented using i32
.
impl Vector<i32, 3>
§Methods for 3d vectors represented using i32
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl<const D: usize> Vector<i64, D>
§Methods for vectors represented using i64
.
impl<const D: usize> Vector<i64, D>
§Methods for vectors represented using i64
.
Sourcepub const fn c_normalize_with(self, magnitude: i64) -> Self
Available on crate feature _int_i64
only.
pub const fn c_normalize_with(self, magnitude: i64) -> Self
_int_i64
only.Returns the normalized vector, using the given vector magnitude
.
$$ \bm{n} = \widehat{\bm{a}} = \frac{1}{d}\thinspace\bm{a} = \frac{\bm{a}}{|\bm{a}|} $$
Sourcepub const fn c_magnitude_sq(self) -> i64 ⓘ
Available on crate feature _int_i64
only.
pub const fn c_magnitude_sq(self) -> i64 ⓘ
_int_i64
only.Calculates the magnitude of the vector (squared).
This is faster than calculating the magnitude, which is useful for comparisons.
§Formula
$$ \large |\vec{V}|^2 = V_0^2 + … + V_n^2 $$
Sourcepub const fn c_add(self, other: Self) -> Self
Available on crate feature _int_i64
only.
pub const fn c_add(self, other: Self) -> Self
_int_i64
only.Adds two vectors together, in compile-time.
Sourcepub const fn c_sub(self, other: Self) -> Self
Available on crate feature _int_i64
only.
pub const fn c_sub(self, other: Self) -> Self
_int_i64
only.Subtracts another vector from this vector, in compile-time.
Sourcepub const fn c_dot(self, other: Self) -> i64 ⓘ
Available on crate feature _int_i64
only.
pub const fn c_dot(self, other: Self) -> i64 ⓘ
_int_i64
only.Computes the dot product of two vectors, in compile-time.
Sourcepub const fn c_scalar_mul(self, scalar: i64) -> Self
Available on crate feature _int_i64
only.
pub const fn c_scalar_mul(self, scalar: i64) -> Self
_int_i64
only.Multiplies each element of the vector by a scalar, in compile-time.
Sourcepub const fn c_scalar_div(self, scalar: i64) -> Self
Available on crate feature _int_i64
only.
pub const fn c_scalar_div(self, scalar: i64) -> Self
_int_i64
only.Divides each element of the vector by a scalar, in compile-time.
Source§impl Vector<i64, 3>
§Methods for 3d vectors represented using i64
.
impl Vector<i64, 3>
§Methods for 3d vectors represented using i64
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl<const D: usize> Vector<i64, D>
§Methods for vectors represented using i64
, signed.
impl<const D: usize> Vector<i64, D>
§Methods for vectors represented using i64
, signed.
Sourcepub const NEG_ONE: Self
Available on crate feature _int_i64
only.
pub const NEG_ONE: Self
_int_i64
only.A Vector
with all negative ones.
Sourcepub const fn c_magnitude_floor(self) -> i64 ⓘ
Available on crate feature _int_i64
only.
pub const fn c_magnitude_floor(self) -> i64 ⓘ
_int_i64
only.Calculates the floored magnitude of the vector.
It could underestimate the true magnitude.
§Features
This will only be const if the “_cmp_i64” feature is enabled.
Sourcepub const fn c_magnitude_ceil(self) -> i64 ⓘ
Available on crate feature _int_i64
only.
pub const fn c_magnitude_ceil(self) -> i64 ⓘ
_int_i64
only.Calculates the ceiled magnitude of the vector.
It could overestimate the true magnitude.
§Features
This will only be const if the “_cmp_i64” feature is enabled.
Sourcepub const fn c_magnitude_round(self) -> i64 ⓘ
Available on crate feature _int_i64
only.
pub const fn c_magnitude_round(self) -> i64 ⓘ
_int_i64
only.Calculates the rounded magnitude of the vector.
§Panics
Can panic if we reach a i128
value close to its maximum during operations.
Source§impl Vector<i128, 3>
§Methods for 3d vectors represented using i128
.
impl Vector<i128, 3>
§Methods for 3d vectors represented using i128
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl Vector<isize, 3>
§Methods for 3d vectors represented using isize
.
impl Vector<isize, 3>
§Methods for 3d vectors represented using isize
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl Vector<u8, 3>
§Methods for 3d vectors represented using u8
.
impl Vector<u8, 3>
§Methods for 3d vectors represented using u8
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl Vector<u16, 3>
§Methods for 3d vectors represented using u16
.
impl Vector<u16, 3>
§Methods for 3d vectors represented using u16
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl<const D: usize> Vector<u32, D>
§Methods for vectors represented using u32
.
impl<const D: usize> Vector<u32, D>
§Methods for vectors represented using u32
.
Sourcepub const fn c_normalize_with(self, magnitude: u32) -> Self
Available on crate feature _int_u32
only.
pub const fn c_normalize_with(self, magnitude: u32) -> Self
_int_u32
only.Returns the normalized vector, using the given vector magnitude
.
$$ \bm{n} = \widehat{\bm{a}} = \frac{1}{d}\thinspace\bm{a} = \frac{\bm{a}}{|\bm{a}|} $$
Sourcepub const fn c_magnitude_sq(self) -> u32 ⓘ
Available on crate feature _int_u32
only.
pub const fn c_magnitude_sq(self) -> u32 ⓘ
_int_u32
only.Calculates the magnitude of the vector (squared).
This is faster than calculating the magnitude, which is useful for comparisons.
§Formula
$$ \large |\vec{V}|^2 = V_0^2 + … + V_n^2 $$
Sourcepub const fn c_add(self, other: Self) -> Self
Available on crate feature _int_u32
only.
pub const fn c_add(self, other: Self) -> Self
_int_u32
only.Adds two vectors together, in compile-time.
Sourcepub const fn c_sub(self, other: Self) -> Self
Available on crate feature _int_u32
only.
pub const fn c_sub(self, other: Self) -> Self
_int_u32
only.Subtracts another vector from this vector, in compile-time.
Sourcepub const fn c_dot(self, other: Self) -> u32 ⓘ
Available on crate feature _int_u32
only.
pub const fn c_dot(self, other: Self) -> u32 ⓘ
_int_u32
only.Computes the dot product of two vectors, in compile-time.
Sourcepub const fn c_scalar_mul(self, scalar: u32) -> Self
Available on crate feature _int_u32
only.
pub const fn c_scalar_mul(self, scalar: u32) -> Self
_int_u32
only.Multiplies each element of the vector by a scalar, in compile-time.
Sourcepub const fn c_scalar_div(self, scalar: u32) -> Self
Available on crate feature _int_u32
only.
pub const fn c_scalar_div(self, scalar: u32) -> Self
_int_u32
only.Divides each element of the vector by a scalar, in compile-time.
Source§impl Vector<u32, 3>
§Methods for 3d vectors represented using u32
.
impl Vector<u32, 3>
§Methods for 3d vectors represented using u32
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl<const D: usize> Vector<u32, D>
§Methods for vectors represented using u32
, unsigned.
impl<const D: usize> Vector<u32, D>
§Methods for vectors represented using u32
, unsigned.
Sourcepub const fn c_magnitude_floor(self) -> u32 ⓘ
Available on crate feature _int_u32
only.
pub const fn c_magnitude_floor(self) -> u32 ⓘ
_int_u32
only.Calculates the floored magnitude of the vector.
It could underestimate the true magnitude.
§Features
This will only be const if the “_cmp_u32” feature is enabled.
Sourcepub const fn c_magnitude_ceil(self) -> u32 ⓘ
Available on crate feature _int_u32
only.
pub const fn c_magnitude_ceil(self) -> u32 ⓘ
_int_u32
only.Calculates the ceiled magnitude of the vector.
It could overestimate the true magnitude.
§Features
This will only be const if the “_cmp_u32” feature is enabled.
Sourcepub const fn c_magnitude_round(self) -> u32 ⓘ
Available on crate feature _int_u32
only.
pub const fn c_magnitude_round(self) -> u32 ⓘ
_int_u32
only.Calculates the rounded magnitude of the vector.
§Panics
Can panic if we reach a u128
value close to its maximum during operations.
Source§impl Vector<u64, 3>
§Methods for 3d vectors represented using u64
.
impl Vector<u64, 3>
§Methods for 3d vectors represented using u64
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl Vector<u128, 3>
§Methods for 3d vectors represented using u128
.
impl Vector<u128, 3>
§Methods for 3d vectors represented using u128
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl Vector<usize, 3>
§Methods for 3d vectors represented using usize
.
impl Vector<usize, 3>
§Methods for 3d vectors represented using usize
.
Sourcepub const fn c_cross(self, other: Self) -> Self
pub const fn c_cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl Vector<f32, 3>
§Methods for 3d vectors represented using f32
.
impl Vector<f32, 3>
§Methods for 3d vectors represented using f32
.
Sourcepub fn cross(self, other: Self) -> Self
pub fn cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Source§impl<const D: usize> Vector<f64, D>
§Methods for vectors represented using f64
.
impl<const D: usize> Vector<f64, D>
§Methods for vectors represented using f64
.
Sourcepub const NEG_ONE: Self
Available on crate feature _float_f64
only.
pub const NEG_ONE: Self
_float_f64
only.A Vector
with all negative ones.
Sourcepub fn normalize(&self) -> Self
Available on crate feature _float_f64
only.
pub fn normalize(&self) -> Self
_float_f64
only.Returns the normalized vector, as a unit vector.
$$ \bm{n} = \widehat{\bm{a}} = \frac{1}{d}\thinspace\bm{a} = \frac{\bm{a}}{|\bm{a}|} $$
Sourcepub fn magnitude_sq(self) -> f64 ⓘ
Available on crate feature _float_f64
only.
pub fn magnitude_sq(self) -> f64 ⓘ
_float_f64
only.Calculates the squared magnitude of the vector.
This is faster than calculating the magnitude, which is useful for comparisons.
§Formula
$$ \large |\vec{V}|^2 = V_0^2 + … + V_n^2 $$
Sourcepub fn add(self, other: Self) -> Self
Available on crate feature _float_f64
only.
pub fn add(self, other: Self) -> Self
_float_f64
only.Adds two vectors together.
Sourcepub fn sub(self, other: Self) -> Self
Available on crate feature _float_f64
only.
pub fn sub(self, other: Self) -> Self
_float_f64
only.Subtracts another vector from this vector.
Sourcepub fn dot(self, other: Self) -> f64 ⓘ
Available on crate feature _float_f64
only.
pub fn dot(self, other: Self) -> f64 ⓘ
_float_f64
only.Computes the dot product of two vectors.
That is the magnitude of one vector in the direction of another.
Also known as the inner produc or the scalar product.
§Formula
$$ \large \vec{a}\cdot\vec{b} = \begin{bmatrix} a_0 \cr … \cr a_n \end{bmatrix} \cdot \begin{bmatrix} b_0 \cr … \cr b_n \end{bmatrix} = a_0 b_0 + … + a_n b_n $$
Source§impl Vector<f64, 3>
§Methods for 3d vectors represented using f64
.
impl Vector<f64, 3>
§Methods for 3d vectors represented using f64
.
Sourcepub fn cross(self, other: Self) -> Self
pub fn cross(self, other: Self) -> Self
Computes the cross product of two vectors.
That is the vector orthogonal to both vectors.
Also known as the exterior product or the vector product.
It is only defined for 3-dimensional vectors, and it is not commutative: $\vec{a}\times\vec{b} = -(\vec{b}\times\vec{a})$.
§Formula
$$ \bm{a} \times \bm{b} = \begin{bmatrix} a_x \cr a_y \cr a_z \end{bmatrix} \times \begin{bmatrix} b_x \cr b_y \cr b_z \end{bmatrix} = \begin{bmatrix} a_y b_z - a_z b_y \cr a_z b_x - a_x b_z \cr a_x b_y - a_y b_x \end{bmatrix} $$
Trait Implementations§
Source§impl<T: Clone + Add<Output = T>, const D: usize> AddAssign<&Vector<T, D>> for Vector<T, D>
impl<T: Clone + Add<Output = T>, const D: usize> AddAssign<&Vector<T, D>> for Vector<T, D>
Source§fn add_assign(&mut self, other: &Self)
fn add_assign(&mut self, other: &Self)
+=
operation. Read moreSource§impl<T: ConstDefault, const D: usize> ConstDefault for Vector<T, D>
impl<T: ConstDefault, const D: usize> ConstDefault for Vector<T, D>
Source§impl<T: Clone + Div<Output = T>, const D: usize> DivAssign<&T> for Vector<T, D>
impl<T: Clone + Div<Output = T>, const D: usize> DivAssign<&T> for Vector<T, D>
Source§fn div_assign(&mut self, scalar: &T)
fn div_assign(&mut self, scalar: &T)
/=
operation. Read moreSource§impl<T: Clone + Div<Output = T>, const D: usize> DivAssign<T> for Vector<T, D>
impl<T: Clone + Div<Output = T>, const D: usize> DivAssign<T> for Vector<T, D>
Source§fn div_assign(&mut self, scalar: T)
fn div_assign(&mut self, scalar: T)
/=
operation. Read moreSource§impl<T: Clone + Mul<Output = T>, const D: usize> MulAssign<&T> for Vector<T, D>
impl<T: Clone + Mul<Output = T>, const D: usize> MulAssign<&T> for Vector<T, D>
Source§fn mul_assign(&mut self, scalar: &T)
fn mul_assign(&mut self, scalar: &T)
*=
operation. Read moreSource§impl<T: Clone + Mul<Output = T>, const D: usize> MulAssign<T> for Vector<T, D>
impl<T: Clone + Mul<Output = T>, const D: usize> MulAssign<T> for Vector<T, D>
Source§fn mul_assign(&mut self, scalar: T)
fn mul_assign(&mut self, scalar: T)
*=
operation. Read moreSource§impl<T: Num, const D: usize> Num for Vector<T, D>
impl<T: Num, const D: usize> Num for Vector<T, D>
Source§fn num_from(value: Self::Inner) -> Result<Self>where
Self: Sized,
fn num_from(value: Self::Inner) -> Result<Self>where
Self: Sized,
Self
if given a valid value
.Source§fn num_from_ref(value: &Self::Inner) -> Result<Self>where
Self: Sized,
fn num_from_ref(value: &Self::Inner) -> Result<Self>where
Self: Sized,
Self
if given a valid &value
.Source§fn num_set_ref(&mut self, value: &Self::Inner) -> Result<()>
fn num_set_ref(&mut self, value: &Self::Inner) -> Result<()>
self
to the given valid &value
.Source§fn num_is_zero(&self) -> Result<bool>
fn num_is_zero(&self) -> Result<bool>
true
if self
is zero.Source§fn num_get_zero() -> Result<Self>where
Self: Sized,
fn num_get_zero() -> Result<Self>where
Self: Sized,
Source§fn num_set_zero(&mut self) -> Result<()>
fn num_set_zero(&mut self) -> Result<()>
self
to 0
.Source§fn num_is_one(&self) -> Result<bool>
fn num_is_one(&self) -> Result<bool>
true
if self
is one.Source§fn num_get_one() -> Result<Self>where
Self: Sized,
fn num_get_one() -> Result<Self>where
Self: Sized,
Source§fn num_set_one(&mut self) -> Result<()>
fn num_set_one(&mut self) -> Result<()>
Source§fn num_add(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
fn num_add(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
self + rhs
(addition).Source§fn num_ref_add(&self, rhs: &Self::Rhs) -> Result<Self::Out>
fn num_ref_add(&self, rhs: &Self::Rhs) -> Result<Self::Out>
num_add
but takes the arguments by reference.Source§fn num_ref_add_assign(&mut self, rhs: &Self::Rhs) -> Result<()>
fn num_ref_add_assign(&mut self, rhs: &Self::Rhs) -> Result<()>
&mut self += rhs;
(addition).Source§fn num_sub(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
fn num_sub(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
self - rhs
(subtraction).Source§fn num_ref_sub(&self, rhs: &Self::Rhs) -> Result<Self::Out>
fn num_ref_sub(&self, rhs: &Self::Rhs) -> Result<Self::Out>
num_sub
but takes the arguments by reference.Source§fn num_ref_sub_assign(&mut self, rhs: &Self::Rhs) -> Result<()>
fn num_ref_sub_assign(&mut self, rhs: &Self::Rhs) -> Result<()>
&mut self -= rhs;
(subtraction).Source§fn num_mul(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
fn num_mul(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
self * rhs
(multiplication).Source§fn num_ref_mul(&self, rhs: &Self::Rhs) -> Result<Self::Out>
fn num_ref_mul(&self, rhs: &Self::Rhs) -> Result<Self::Out>
num_mul
but takes the arguments by reference.Source§fn num_ref_mul_assign(&mut self, rhs: &Self::Rhs) -> Result<()>
fn num_ref_mul_assign(&mut self, rhs: &Self::Rhs) -> Result<()>
&mut self *= rhs;
(multiplication).Source§fn num_div(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
fn num_div(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
self / rhs
(division).Source§fn num_ref_div(&self, rhs: &Self::Rhs) -> Result<Self::Out>
fn num_ref_div(&self, rhs: &Self::Rhs) -> Result<Self::Out>
num_div
but takes the arguments by reference.Source§fn num_ref_div_assign(&mut self, rhs: &Self::Rhs) -> Result<()>
fn num_ref_div_assign(&mut self, rhs: &Self::Rhs) -> Result<()>
&mut self /= rhs;
(division).Source§fn num_rem(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
fn num_rem(self, rhs: Self::Rhs) -> Result<Self::Out>where
Self: Sized,
self % rhs
(remainder).Source§fn num_ref_rem(&self, rhs: &Self::Rhs) -> Result<Self::Out>
fn num_ref_rem(&self, rhs: &Self::Rhs) -> Result<Self::Out>
num_rem
but takes the arguments by reference.Source§impl<T: Clone + Sub<Output = T>, const D: usize> SubAssign<&Vector<T, D>> for Vector<T, D>
impl<T: Clone + Sub<Output = T>, const D: usize> SubAssign<&Vector<T, D>> for Vector<T, D>
Source§fn sub_assign(&mut self, other: &Self)
fn sub_assign(&mut self, other: &Self)
-=
operation. Read moreSource§impl<T: Num + 'static, const D: usize> TryInto<Box<dyn NumVector<Rhs = Vector<T, D>, Inner = [T; D], Out = Vector<T, D>, Scalar = T>>> for Vector<T, D>
Available on crate feature alloc
only.
impl<T: Num + 'static, const D: usize> TryInto<Box<dyn NumVector<Rhs = Vector<T, D>, Inner = [T; D], Out = Vector<T, D>, Scalar = T>>> for Vector<T, D>
alloc
only.impl<T: Copy, const D: usize> Copy for Vector<T, D>
impl<T: Eq, const D: usize> Eq for Vector<T, D>
Auto Trait Implementations§
impl<T, const D: usize> Freeze for Vector<T, D>where
T: Freeze,
impl<T, const D: usize> RefUnwindSafe for Vector<T, D>where
T: RefUnwindSafe,
impl<T, const D: usize> Send for Vector<T, D>where
T: Send,
impl<T, const D: usize> Sync for Vector<T, D>where
T: Sync,
impl<T, const D: usize> Unpin for Vector<T, D>where
T: Unpin,
impl<T, const D: usize> UnwindSafe for Vector<T, D>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
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more