[−][src]Struct definitive::Vector
A generic type representing an N dimensional vector
Methods
impl<T, const N: usize> Vector<T, { N }>
[src]
pub fn new(components: [T; { N }]) -> Self
[src]
Create a new vector out of some components
Note: Vector
also implements From<[T, {N}]>
which can be cleaner
pub fn resize_with<const M: usize>(
self,
fill: impl FnMut() -> T
) -> Vector<T, { M }>
[src]
self,
fill: impl FnMut() -> T
) -> Vector<T, { M }>
Resize the vector to { M }
length, either truncating or filling with
fill
See also resize
, resize_zero
and resize_one
for Vector<T, _>'s
that have Default
, Zero
and One
implementations, respectively
impl<T: Default, const N: usize> Vector<T, { N }>
[src]
pub fn resize<const M: usize>(self) -> Vector<T, { M }>
[src]
Resize the vector to { M }
lenght, either truncating or filling with
T::default
impl<T: One, const N: usize> Vector<T, { N }>
[src]
pub fn resize_one<const M: usize>(self) -> Vector<T, { M }>
[src]
Resize the vector to { M }
lenght, either truncating or filling with
T::one
impl<T: Zero, const N: usize> Vector<T, { N }>
[src]
pub fn resize_zero<const M: usize>(self) -> Vector<T, { M }>
[src]
Resize the vector to { M }
lenght, either truncating or filling with
T::one
impl<T: Mul<Output = T> + Add<Output = T> + Zero, const N: usize> Vector<T, { N }>
[src]
impl<T: Mul<Output = T> + Add<Output = T> + Clone + Zero, const N: usize> Vector<T, { N }>
[src]
pub fn length2(&self) -> T
[src]
Calculate the length of the vector and square it
A1^2 + A2^2 + ... + An^2
impl<T: Mul<Output = T> + Add<Output = T> + Clone + Zero + Sqrt, const N: usize> Vector<T, { N }>
[src]
pub fn length(&self) -> T
[src]
Calculate the length/magnitude of the vector
sqrt(A1^2 + A2^2 + ... + An^2)
impl<T: Mul<Output = T> + Div<Output = T> + Add<Output = T> + Clone + Zero + Sqrt, const N: usize> Vector<T, { N }>
[src]
Trait Implementations
impl<T: One, const N: usize> One for Vector<T, { N }>
[src]
impl<T: Zero, const N: usize> Zero for Vector<T, { N }>
[src]
impl<T, const N: usize> From<[T; N]> for Vector<T, { N }>
[src]
impl<T: Clone, const N: usize> Clone for Vector<T, { N }>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy, const N: usize> Copy for Vector<T, { N }>
[src]
impl<T: Eq, const N: usize> Eq for Vector<T, { N }>
[src]
impl<T: Tr, const N: usize> PartialEq<Vector<T, N>> for Vector<T, { N }>
[src]
impl<T: Debug, const N: usize> Debug for Vector<T, { N }>
[src]
impl<T: Div<Output = T>, const N: usize> Div<Vector<T, N>> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the /
operator.
default fn div(self, rhs: Self) -> Self::Output
[src]
impl<T: Div<T, Output = T> + Clone, const N: usize> Div<T> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the /
operator.
fn div(self, rhs: T) -> Self::Output
[src]
impl<T: Rem<Output = T>, const N: usize> Rem<Vector<T, N>> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the %
operator.
default fn rem(self, rhs: Self) -> Self::Output
[src]
impl<T: Rem<T, Output = T> + Clone, const N: usize> Rem<T> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the %
operator.
fn rem(self, rhs: T) -> Self::Output
[src]
impl<T: Sub<Output = T>, const N: usize> Sub<Vector<T, N>> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the -
operator.
default fn sub(self, rhs: Self) -> Self::Output
[src]
impl<T: Sub<T, Output = T> + Clone, const N: usize> Sub<T> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the -
operator.
fn sub(self, rhs: T) -> Self::Output
[src]
impl<T: Add<Output = T>, const N: usize> Add<Vector<T, N>> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the +
operator.
default fn add(self, rhs: Self) -> Self::Output
[src]
impl<T: Add<T, Output = T> + Clone, const N: usize> Add<T> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the +
operator.
fn add(self, rhs: T) -> Self::Output
[src]
impl<T: Mul<Output = T>, const N: usize> Mul<Vector<T, N>> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the *
operator.
default fn mul(self, rhs: Self) -> Self::Output
[src]
impl<T: Mul<T, Output = T> + Clone, const N: usize> Mul<T> for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the *
operator.
fn mul(self, rhs: T) -> Self::Output
[src]
impl<T: Neg<Output = T>, const N: usize> Neg for Vector<T, { N }>
[src]
type Output = Vector<T, { N }>
The resulting type after applying the -
operator.
default fn neg(self) -> Self::Output
[src]
impl<T: AddAssign, const N: usize> AddAssign<Vector<T, N>> for Vector<T, { N }>
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl<T: AddAssign<T> + Clone, const N: usize> AddAssign<T> for Vector<T, { N }>
[src]
fn add_assign(&mut self, rhs: T)
[src]
impl<T: SubAssign, const N: usize> SubAssign<Vector<T, N>> for Vector<T, { N }>
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
impl<T: SubAssign<T> + Clone, const N: usize> SubAssign<T> for Vector<T, { N }>
[src]
fn sub_assign(&mut self, rhs: T)
[src]
impl<T: MulAssign, const N: usize> MulAssign<Vector<T, N>> for Vector<T, { N }>
[src]
fn mul_assign(&mut self, rhs: Self)
[src]
impl<T: MulAssign<T> + Clone, const N: usize> MulAssign<T> for Vector<T, { N }>
[src]
fn mul_assign(&mut self, rhs: T)
[src]
impl<T: DivAssign, const N: usize> DivAssign<Vector<T, N>> for Vector<T, { N }>
[src]
fn div_assign(&mut self, rhs: Self)
[src]
impl<T: DivAssign<T> + Clone, const N: usize> DivAssign<T> for Vector<T, { N }>
[src]
fn div_assign(&mut self, rhs: T)
[src]
impl<T: RemAssign, const N: usize> RemAssign<Vector<T, N>> for Vector<T, { N }>
[src]
fn rem_assign(&mut self, rhs: Self)
[src]
impl<T: RemAssign<T> + Clone, const N: usize> RemAssign<T> for Vector<T, { N }>
[src]
fn rem_assign(&mut self, rhs: T)
[src]
impl<T, const N: usize> Deref for Vector<T, { N }>
[src]
type Target = [T; { N }]
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<T, const N: usize> DerefMut for Vector<T, { N }>
[src]
Auto Trait Implementations
impl<const N: usize, T> Send for Vector<T, N> where
T: Send,
T: Send,
impl<const N: usize, T> Sync for Vector<T, N> where
T: Sync,
T: Sync,
impl<const N: usize, T> Unpin for Vector<T, N> where
T: Unpin,
T: Unpin,
impl<const N: usize, T> UnwindSafe for Vector<T, N> where
T: UnwindSafe,
T: UnwindSafe,
impl<const N: usize, T> RefUnwindSafe for Vector<T, N> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,