Struct coord::vec2::Vec2[][src]

pub struct Vec2<T: VecItem> {
    pub x: T,
    pub y: T,
}

Fields

Methods

impl<T: VecItem> Vec2<T>
[src]

Creates a new Vec2 from multiple components

Returns the elements of the vector as an array

Apply an operation to all elements of this vector, returning the result

Trait Implementations

impl<T: Copy + VecItem> Copy for Vec2<T>
[src]

impl<T: Clone + VecItem> Clone for Vec2<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Default + VecItem> Default for Vec2<T>
[src]

Returns the "default value" for a type. Read more

impl<T: Hash + VecItem> Hash for Vec2<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: Eq + VecItem> Eq for Vec2<T>
[src]

impl<T: PartialEq + VecItem> PartialEq for Vec2<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: VecItem> Vector for Vec2<T>
[src]

impl<T: VecItem + Debug> Debug for Vec2<T>
[src]

Formats the value using the given formatter. Read more

impl<T: VecItem + Display> Display for Vec2<T>
[src]

Formats the value using the given formatter. Read more

impl<T: VecItem> From<[T; 2]> for Vec2<T>
[src]

Performs the conversion.

impl<T: VecItem> From<(T, T)> for Vec2<T>
[src]

Performs the conversion.

impl<T> Add for Vec2<T> where
    T: VecItem + Add,
    T::Output: VecItem + Add
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl<T> Sub for Vec2<T> where
    T: VecItem + Sub,
    T::Output: VecItem + Sub
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl<T> Mul for Vec2<T> where
    T: VecItem + Mul,
    T::Output: VecItem + Mul
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<T> Div for Vec2<T> where
    T: VecItem + Div,
    T::Output: VecItem + Div
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl<T> Add<T> for Vec2<T> where
    T: VecItem + Add,
    T::Output: VecItem + Add
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl<T> Sub<T> for Vec2<T> where
    T: VecItem + Sub,
    T::Output: VecItem + Sub
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl<T> Mul<T> for Vec2<T> where
    T: VecItem + Mul,
    T::Output: VecItem + Mul
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<T> Div<T> for Vec2<T> where
    T: VecItem + Div,
    T::Output: VecItem + Div
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl<T> AddAssign for Vec2<T> where
    T: VecItem + Add<Output = T>, 
[src]

Performs the += operation.

impl<T> SubAssign for Vec2<T> where
    T: VecItem + Sub<Output = T>, 
[src]

Performs the -= operation.

impl<T> MulAssign for Vec2<T> where
    T: VecItem + Mul<Output = T>, 
[src]

Performs the *= operation.

impl<T> DivAssign for Vec2<T> where
    T: VecItem + Div<Output = T>, 
[src]

Performs the /= operation.

impl<T> AddAssign<T> for Vec2<T> where
    T: VecItem + Add<Output = T>, 
[src]

Performs the += operation.

impl<T> SubAssign<T> for Vec2<T> where
    T: VecItem + Sub<Output = T>, 
[src]

Performs the -= operation.

impl<T> MulAssign<T> for Vec2<T> where
    T: VecItem + Mul<Output = T>, 
[src]

Performs the *= operation.

impl<T> DivAssign<T> for Vec2<T> where
    T: VecItem + Div<Output = T>, 
[src]

Performs the /= operation.

impl<T> VecNum for Vec2<T> where
    T: VecItem + Num
[src]

Calculates the sum of all components of the vector

Calculates the produce of all components of the vector

impl<T> VecInt for Vec2<T> where
    T: VecItem + Integer
[src]

Performs a Eucledian division (i.e: rounds towards negative infinity) operation upon the vector

impl<T> VecSigned for Vec2<T> where
    T: VecItem + Signed
[src]

Calculates the snake length (also known as 'manhattan distance') of the vector Read more

impl<T> VecFloat for Vec2<T> where
    T: VecItem + Float
[src]

Calculates the magnitude of the vector

Calculates the normalized form of the vector (i.e: a vector with identical direction but a magnitude of 1)

Rounds each element of the vector down to the nearest whole number

Rounds each element of the vector up to the nearest whole number

Rounds each element of the vector to the nearest whole number

Auto Trait Implementations

impl<T> Send for Vec2<T> where
    T: Send

impl<T> Sync for Vec2<T> where
    T: Sync