Struct coord::vec1::Vec1 [−][src]
pub struct Vec1<T: VecItem> { pub x: T, }
Fields
x: T
Methods
impl<T: VecItem> Vec1<T>
[src]
impl<T: VecItem> Vec1<T>
pub fn new(x: T) -> Self
[src]
pub fn new(x: T) -> Self
Creates a new Vec1 from a single component
pub fn elements(&self) -> [T; 1]
[src]
pub fn elements(&self) -> [T; 1]
Returns the elements of the vector as an array
pub fn map<U: VecItem, F: Fn(T) -> U>(&self, f: F) -> Vec1<U>
[src]
pub fn map<U: VecItem, F: Fn(T) -> U>(&self, f: F) -> Vec1<U>
Apply an operation to all elements of this vector, returning the result
pub fn convert_to<U: VecItem + From<T>>(&self) -> Vec1<U>
[src]
pub fn convert_to<U: VecItem + From<T>>(&self) -> Vec1<U>
Trait Implementations
impl<T: Copy + VecItem> Copy for Vec1<T>
[src]
impl<T: Copy + VecItem> Copy for Vec1<T>
impl<T: Clone + VecItem> Clone for Vec1<T>
[src]
impl<T: Clone + VecItem> Clone for Vec1<T>
fn clone(&self) -> Vec1<T>
[src]
fn clone(&self) -> Vec1<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Default + VecItem> Default for Vec1<T>
[src]
impl<T: Default + VecItem> Default for Vec1<T>
impl<T: Hash + VecItem> Hash for Vec1<T>
[src]
impl<T: Hash + VecItem> Hash for Vec1<T>
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Eq + VecItem> Eq for Vec1<T>
[src]
impl<T: Eq + VecItem> Eq for Vec1<T>
impl<T: PartialEq + VecItem> PartialEq for Vec1<T>
[src]
impl<T: PartialEq + VecItem> PartialEq for Vec1<T>
fn eq(&self, other: &Vec1<T>) -> bool
[src]
fn eq(&self, other: &Vec1<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Vec1<T>) -> bool
[src]
fn ne(&self, other: &Vec1<T>) -> bool
This method tests for !=
.
impl<T: VecItem> Vector for Vec1<T>
[src]
impl<T: VecItem> Vector for Vec1<T>
type Item = T
impl<T: VecItem + Debug> Debug for Vec1<T>
[src]
impl<T: VecItem + Debug> Debug for Vec1<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: VecItem + Display> Display for Vec1<T>
[src]
impl<T: VecItem + Display> Display for Vec1<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: VecItem> From<T> for Vec1<T>
[src]
impl<T: VecItem> From<T> for Vec1<T>
impl<T: VecItem> From<[T; 1]> for Vec1<T>
[src]
impl<T: VecItem> From<[T; 1]> for Vec1<T>
impl<T> Add for Vec1<T> where
T: VecItem + Add,
T::Output: VecItem + Add,
[src]
impl<T> Add for Vec1<T> where
T: VecItem + Add,
T::Output: VecItem + Add,
type Output = Vec1<T::Output>
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Vec1<T::Output>
[src]
fn add(self, other: Self) -> Vec1<T::Output>
Performs the +
operation.
impl<T> Sub for Vec1<T> where
T: VecItem + Sub,
T::Output: VecItem + Sub,
[src]
impl<T> Sub for Vec1<T> where
T: VecItem + Sub,
T::Output: VecItem + Sub,
type Output = Vec1<T::Output>
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Vec1<T::Output>
[src]
fn sub(self, other: Self) -> Vec1<T::Output>
Performs the -
operation.
impl<T> Mul for Vec1<T> where
T: VecItem + Mul,
T::Output: VecItem + Mul,
[src]
impl<T> Mul for Vec1<T> where
T: VecItem + Mul,
T::Output: VecItem + Mul,
type Output = Vec1<T::Output>
The resulting type after applying the *
operator.
fn mul(self, other: Self) -> Vec1<T::Output>
[src]
fn mul(self, other: Self) -> Vec1<T::Output>
Performs the *
operation.
impl<T> Div for Vec1<T> where
T: VecItem + Div,
T::Output: VecItem + Div,
[src]
impl<T> Div for Vec1<T> where
T: VecItem + Div,
T::Output: VecItem + Div,
type Output = Vec1<T::Output>
The resulting type after applying the /
operator.
fn div(self, other: Self) -> Vec1<T::Output>
[src]
fn div(self, other: Self) -> Vec1<T::Output>
Performs the /
operation.
impl<T> Add<T> for Vec1<T> where
T: VecItem + Add,
T::Output: VecItem + Add,
[src]
impl<T> Add<T> for Vec1<T> where
T: VecItem + Add,
T::Output: VecItem + Add,
type Output = Vec1<T::Output>
The resulting type after applying the +
operator.
fn add(self, other: T) -> Vec1<T::Output>
[src]
fn add(self, other: T) -> Vec1<T::Output>
Performs the +
operation.
impl<T> Sub<T> for Vec1<T> where
T: VecItem + Sub,
T::Output: VecItem + Sub,
[src]
impl<T> Sub<T> for Vec1<T> where
T: VecItem + Sub,
T::Output: VecItem + Sub,
type Output = Vec1<T::Output>
The resulting type after applying the -
operator.
fn sub(self, other: T) -> Vec1<T::Output>
[src]
fn sub(self, other: T) -> Vec1<T::Output>
Performs the -
operation.
impl<T> Mul<T> for Vec1<T> where
T: VecItem + Mul,
T::Output: VecItem + Mul,
[src]
impl<T> Mul<T> for Vec1<T> where
T: VecItem + Mul,
T::Output: VecItem + Mul,
type Output = Vec1<T::Output>
The resulting type after applying the *
operator.
fn mul(self, other: T) -> Vec1<T::Output>
[src]
fn mul(self, other: T) -> Vec1<T::Output>
Performs the *
operation.
impl<T> Div<T> for Vec1<T> where
T: VecItem + Div,
T::Output: VecItem + Div,
[src]
impl<T> Div<T> for Vec1<T> where
T: VecItem + Div,
T::Output: VecItem + Div,
type Output = Vec1<T::Output>
The resulting type after applying the /
operator.
fn div(self, other: T) -> Vec1<T::Output>
[src]
fn div(self, other: T) -> Vec1<T::Output>
Performs the /
operation.
impl<T> AddAssign for Vec1<T> where
T: VecItem + Add<Output = T>,
[src]
impl<T> AddAssign for Vec1<T> where
T: VecItem + Add<Output = T>,
fn add_assign(&mut self, other: Self)
[src]
fn add_assign(&mut self, other: Self)
Performs the +=
operation.
impl<T> SubAssign for Vec1<T> where
T: VecItem + Sub<Output = T>,
[src]
impl<T> SubAssign for Vec1<T> where
T: VecItem + Sub<Output = T>,
fn sub_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
Performs the -=
operation.
impl<T> MulAssign for Vec1<T> where
T: VecItem + Mul<Output = T>,
[src]
impl<T> MulAssign for Vec1<T> where
T: VecItem + Mul<Output = T>,
fn mul_assign(&mut self, other: Self)
[src]
fn mul_assign(&mut self, other: Self)
Performs the *=
operation.
impl<T> DivAssign for Vec1<T> where
T: VecItem + Div<Output = T>,
[src]
impl<T> DivAssign for Vec1<T> where
T: VecItem + Div<Output = T>,
fn div_assign(&mut self, other: Self)
[src]
fn div_assign(&mut self, other: Self)
Performs the /=
operation.
impl<T> AddAssign<T> for Vec1<T> where
T: VecItem + Add<Output = T>,
[src]
impl<T> AddAssign<T> for Vec1<T> where
T: VecItem + Add<Output = T>,
fn add_assign(&mut self, other: T)
[src]
fn add_assign(&mut self, other: T)
Performs the +=
operation.
impl<T> SubAssign<T> for Vec1<T> where
T: VecItem + Sub<Output = T>,
[src]
impl<T> SubAssign<T> for Vec1<T> where
T: VecItem + Sub<Output = T>,
fn sub_assign(&mut self, other: T)
[src]
fn sub_assign(&mut self, other: T)
Performs the -=
operation.
impl<T> MulAssign<T> for Vec1<T> where
T: VecItem + Mul<Output = T>,
[src]
impl<T> MulAssign<T> for Vec1<T> where
T: VecItem + Mul<Output = T>,
fn mul_assign(&mut self, other: T)
[src]
fn mul_assign(&mut self, other: T)
Performs the *=
operation.
impl<T> DivAssign<T> for Vec1<T> where
T: VecItem + Div<Output = T>,
[src]
impl<T> DivAssign<T> for Vec1<T> where
T: VecItem + Div<Output = T>,
fn div_assign(&mut self, other: T)
[src]
fn div_assign(&mut self, other: T)
Performs the /=
operation.
impl<T> VecNum for Vec1<T> where
T: VecItem + Num,
[src]
impl<T> VecNum for Vec1<T> where
T: VecItem + Num,
fn sum(&self) -> Self::Item
[src]
fn sum(&self) -> Self::Item
Calculates the sum of all components of the vector
fn product(&self) -> Self::Item
[src]
fn product(&self) -> Self::Item
Calculates the produce of all components of the vector
impl<T> VecInt for Vec1<T> where
T: VecItem + Integer,
[src]
impl<T> VecInt for Vec1<T> where
T: VecItem + Integer,
fn div_euc(&self, other: Self) -> Self
[src]
fn div_euc(&self, other: Self) -> Self
Performs a Eucledian division (i.e: rounds towards negative infinity) operation upon the vector
impl<T> VecSigned for Vec1<T> where
T: VecItem + Signed,
[src]
impl<T> VecSigned for Vec1<T> where
T: VecItem + Signed,
fn snake_length(&self) -> Self::Item
[src]
fn snake_length(&self) -> Self::Item
Calculates the snake length (also known as 'manhattan distance') of the vector Read more
impl<T> VecFloat for Vec1<T> where
T: VecItem + Float,
[src]
impl<T> VecFloat for Vec1<T> where
T: VecItem + Float,
fn length(&self) -> Self::Item
[src]
fn length(&self) -> Self::Item
Calculates the magnitude of the vector
fn norm(&self) -> Self
[src]
fn norm(&self) -> Self
Calculates the normalized form of the vector (i.e: a vector with identical direction but a magnitude of 1)
fn floor(&self) -> Self
[src]
fn floor(&self) -> Self
Rounds each element of the vector down to the nearest whole number
fn ceil(&self) -> Self
[src]
fn ceil(&self) -> Self
Rounds each element of the vector up to the nearest whole number
fn round(&self) -> Self
[src]
fn round(&self) -> Self
Rounds each element of the vector to the nearest whole number