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

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

Fields

x: Ty: T

Methods

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

pub fn new(x: T, y: T) -> Self[src]

Creates a new Vec2 from multiple components

pub fn elements(&self) -> [T; 2][src]

Returns the elements of the vector as an array

pub fn map<U: VecItem, F: Fn(T) -> U>(&self, f: F) -> Vec2<U>[src]

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

pub fn convert_to<U: VecItem + From<T>>(&self) -> Vec2<U>[src]

Trait Implementations

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

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

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

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

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

type Item = T

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

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

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

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

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

type Output = Vec2<T::Output>

The resulting type after applying the / operator.

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

type Output = Vec2<T::Output>

The resulting type after applying the / operator.

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

type Output = Vec2<T::Output>

The resulting type after applying the - operator.

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

type Output = Vec2<T::Output>

The resulting type after applying the - operator.

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

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

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

type Output = Vec2<T::Output>

The resulting type after applying the + operator.

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

type Output = Vec2<T::Output>

The resulting type after applying the + operator.

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

type Output = Vec2<T::Output>

The resulting type after applying the * operator.

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

type Output = Vec2<T::Output>

The resulting type after applying the * operator.

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

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

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

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

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

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

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

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

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

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

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

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

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

impl<V> VecDot for V where
    V: Copy + VecNum + Mul<V, Output = V>,
    <V as Vector>::Item: VecItem,
    <V as Vector>::Item: Num
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]