# [−][src]Struct cgmath::Vector2

    #[repr(C)]
    pub struct Vector2<S> {
        pub x: S,
        pub y: S,
    }

A 2-dimensional vector.

This type is marked as `#[repr(C)]`.

## Fields

`x: S`

The x component of the vector.

`y: S`

The y component of the vector.

## Methods

### `impl<S> Vector2<S>`[src]

#### `pub const fn new(x: S, y: S) -> Vector2<S>`[src]

Construct a new vector, using the provided values.

#### `pub fn map<U, F>(self, f: F) -> Vector2<U> where
F: FnMut(S) -> U,` [src]

Perform the given operation on each field in the vector, returning a new point constructed from the operations.

### `impl<S: NumCast + Copy> Vector2<S>`[src]

#### `pub fn cast<T: NumCast>(&self) -> Option<Vector2<T>>`[src]

Component-wise casting to another type.

### `impl<S: BaseNum> Vector2<S>`[src]

#### `pub fn unit_x() -> Vector2<S>`[src]

A unit vector in the `x` direction.

#### `pub fn unit_y() -> Vector2<S>`[src]

A unit vector in the `y` direction.

#### `pub fn perp_dot(self, other: Vector2<S>) -> S`[src]

The perpendicular dot product of the vector and `other`.

#### `pub fn extend(self, z: S) -> Vector3<S>`[src]

Create a `Vector3`, using the `x` and `y` values from this vector, and the provided `z`.

## Trait Implementations

### `impl<S: Copy> Array for Vector2<S>`[src]

#### `type Element = S`

#### `fn len() -> usize`[src]

Get the number of elements in the array type Read more

#### `fn from_value(scalar: S) -> Vector2<S>`[src]

Construct a vector from a single value, replicating it. Read more

#### `fn sum(self) -> S where
S: Add<Output = S>,` [src]

The sum of the elements of the array.

#### `fn product(self) -> S where
S: Mul<Output = S>,` [src]

The product of the elements of the array.

#### `fn is_finite(&self) -> bool where
S: BaseFloat,` [src]

Whether all elements of the array are finite

#### `fn as_ptr(&self) -> *const Self::Element`[src]

Get the pointer to the first element of the array.

#### `fn as_mut_ptr(&mut self) -> *mut Self::Element`[src]

Get a mutable pointer to the first element of the array.

#### `fn swap_elements(&mut self, i: usize, j: usize)`[src]

Swap the elements at indices `i` and `j` in-place.

### `impl<S: BaseNum> ElementWise<Vector2<S>> for Vector2<S>`[src]

#### `fn add_element_wise(self, rhs: Vector2<S>) -> Vector2<S>`[src]

#### `fn sub_element_wise(self, rhs: Vector2<S>) -> Vector2<S>`[src]

#### `fn mul_element_wise(self, rhs: Vector2<S>) -> Vector2<S>`[src]

#### `fn div_element_wise(self, rhs: Vector2<S>) -> Vector2<S>`[src]

#### `fn rem_element_wise(self, rhs: Vector2<S>) -> Vector2<S>`[src]

#### `fn add_assign_element_wise(&mut self, rhs: Vector2<S>)`[src]

#### `fn sub_assign_element_wise(&mut self, rhs: Vector2<S>)`[src]

#### `fn mul_assign_element_wise(&mut self, rhs: Vector2<S>)`[src]

#### `fn div_assign_element_wise(&mut self, rhs: Vector2<S>)`[src]

#### `fn rem_assign_element_wise(&mut self, rhs: Vector2<S>)`[src]

### `impl<S: BaseNum> ElementWise<S> for Vector2<S>`[src]

#### `fn add_element_wise(self, rhs: S) -> Vector2<S>`[src]

#### `fn sub_element_wise(self, rhs: S) -> Vector2<S>`[src]

#### `fn mul_element_wise(self, rhs: S) -> Vector2<S>`[src]

#### `fn div_element_wise(self, rhs: S) -> Vector2<S>`[src]

#### `fn rem_element_wise(self, rhs: S) -> Vector2<S>`[src]

#### `fn add_assign_element_wise(&mut self, rhs: S)`[src]

#### `fn sub_assign_element_wise(&mut self, rhs: S)`[src]

#### `fn mul_assign_element_wise(&mut self, rhs: S)`[src]

#### `fn div_assign_element_wise(&mut self, rhs: S)`[src]

#### `fn rem_assign_element_wise(&mut self, rhs: S)`[src]

### `impl<S: BaseNum> VectorSpace for Vector2<S>`[src]

#### `type Scalar = S`

The associated scalar.

#### `fn lerp(self, other: Self, amount: Self::Scalar) -> Self`[src]

Returns the result of linearly interpolating the vector towards `other` by the specified amount. Read more

### `impl<S: BaseFloat> MetricSpace for Vector2<S>`[src]

#### `type Metric = S`

The metric to be returned by the `distance` function.

#### `fn distance2(self, other: Self) -> S`[src]

Returns the squared distance. Read more

#### `fn distance(self, other: Self) -> Self::Metric`[src]

The distance between two values.

### `impl<S: BaseFloat> InnerSpace for Vector2<S>`[src]

#### `fn dot(self, other: Vector2<S>) -> S`[src]

Vector dot (or inner) product.

#### `fn angle(self, other: Vector2<S>) -> Rad<S>`[src]

Returns the angle between two vectors in radians.

#### `fn is_perpendicular(self, other: Self) -> bool`[src]

Returns `true` if the vector is perpendicular (at right angles) to the other vector. Read more

#### `fn magnitude2(self) -> Self::Scalar`[src]

Returns the squared magnitude. Read more

#### `fn magnitude(self) -> Self::Scalar`[src]

The distance from the tail to the tip of the vector.

#### `fn normalize(self) -> Self`[src]

Returns a vector with the same direction, but with a magnitude of `1`.

#### `fn normalize_to(self, magnitude: Self::Scalar) -> Self`[src]

Returns a vector with the same direction and a given magnitude.

#### `fn project_on(self, other: Self) -> Self`[src]

Returns the vector projection of the current inner space projected onto the supplied argument. Read more

### `impl<S> Into<[S; 2]> for Vector2<S>`[src]

#### `fn into(self) -> [S; 2]`[src]

Performs the conversion.

### `impl<S> Into<(S, S)> for Vector2<S>`[src]

#### `fn into(self) -> (S, S)`[src]

Performs the conversion.

### `impl<S: Eq> Eq for Vector2<S>`[src]

### `impl<S> AsMut<[S; 2]> for Vector2<S>`[src]

#### `fn as_mut(&mut self) -> &mut [S; 2]`[src]

Performs the conversion.

### `impl<S> AsMut<(S, S)> for Vector2<S>`[src]

#### `fn as_mut(&mut self) -> &mut (S, S)`[src]

Performs the conversion.

### `impl<S: Clone> Clone for Vector2<S>`[src]

#### `fn clone(&self) -> Vector2<S>`[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`1.0.0[src]

Performs copy-assignment from `source`. Read more

### `impl<S> AsRef<[S; 2]> for Vector2<S>`[src]

#### `fn as_ref(&self) -> &[S; 2]`[src]

Performs the conversion.

### `impl<S> AsRef<(S, S)> for Vector2<S>`[src]

#### `fn as_ref(&self) -> &(S, S)`[src]

Performs the conversion.

### `impl<S: PartialEq> PartialEq<Vector2<S>> for Vector2<S>`[src]

#### `fn eq(&self, other: &Vector2<S>) -> bool`[src]

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

#### `fn ne(&self, other: &Vector2<S>) -> bool`[src]

This method tests for `!=`.

### `impl<S: Clone> From<[S; 2]> for Vector2<S>`[src]

#### `fn from(v: [S; 2]) -> Vector2<S>`[src]

Performs the conversion.

### `impl<'a, S> From<&'a [S; 2]> for &'a Vector2<S>`[src]

#### `fn from(v: &'a [S; 2]) -> &'a Vector2<S>`[src]

Performs the conversion.

### `impl<'a, S> From<&'a mut [S; 2]> for &'a mut Vector2<S>`[src]

#### `fn from(v: &'a mut [S; 2]) -> &'a mut Vector2<S>`[src]

Performs the conversion.

### `impl<S> From<(S, S)> for Vector2<S>`[src]

#### `fn from(v: (S, S)) -> Vector2<S>`[src]

Performs the conversion.

### `impl<'a, S> From<&'a (S, S)> for &'a Vector2<S>`[src]

#### `fn from(v: &'a (S, S)) -> &'a Vector2<S>`[src]

Performs the conversion.

### `impl<'a, S> From<&'a mut (S, S)> for &'a mut Vector2<S>`[src]

#### `fn from(v: &'a mut (S, S)) -> &'a mut Vector2<S>`[src]

Performs the conversion.

### `impl<S: Copy> Copy for Vector2<S>`[src]

### `impl<S: Hash> Hash for Vector2<S>`[src]

#### `fn hash<__H: Hasher>(&self, state: &mut __H)`[src]

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]

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

### `impl<S: BaseNum> Add<Vector2<S>> for Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: Vector2<S>) -> Vector2<S>`[src]

Performs the `+` operation.

### `impl<'a, S: BaseNum> Add<&'a Vector2<S>> for Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: &'a Vector2<S>) -> Vector2<S>`[src]

Performs the `+` operation.

### `impl<'a, S: BaseNum> Add<Vector2<S>> for &'a Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: Vector2<S>) -> Vector2<S>`[src]

Performs the `+` operation.

### `impl<'a, 'b, S: BaseNum> Add<&'a Vector2<S>> for &'b Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: &'a Vector2<S>) -> Vector2<S>`[src]

Performs the `+` operation.

### `impl<S: BaseNum> Add<Vector2<S>> for Point2<S>`[src]

#### `type Output = Point2<S>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: Vector2<S>) -> Point2<S>`[src]

Performs the `+` operation.

### `impl<'a, S: BaseNum> Add<&'a Vector2<S>> for Point2<S>`[src]

#### `type Output = Point2<S>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: &'a Vector2<S>) -> Point2<S>`[src]

Performs the `+` operation.

### `impl<'a, S: BaseNum> Add<Vector2<S>> for &'a Point2<S>`[src]

#### `type Output = Point2<S>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: Vector2<S>) -> Point2<S>`[src]

Performs the `+` operation.

### `impl<'a, 'b, S: BaseNum> Add<&'a Vector2<S>> for &'b Point2<S>`[src]

#### `type Output = Point2<S>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: &'a Vector2<S>) -> Point2<S>`[src]

Performs the `+` operation.

### `impl<S: BaseNum> Sub<Vector2<S>> for Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: Vector2<S>) -> Vector2<S>`[src]

Performs the `-` operation.

### `impl<'a, S: BaseNum> Sub<&'a Vector2<S>> for Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: &'a Vector2<S>) -> Vector2<S>`[src]

Performs the `-` operation.

### `impl<'a, S: BaseNum> Sub<Vector2<S>> for &'a Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: Vector2<S>) -> Vector2<S>`[src]

Performs the `-` operation.

### `impl<'a, 'b, S: BaseNum> Sub<&'a Vector2<S>> for &'b Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: &'a Vector2<S>) -> Vector2<S>`[src]

Performs the `-` operation.

### `impl<S: BaseNum> Sub<Vector2<S>> for Point2<S>`[src]

#### `type Output = Point2<S>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: Vector2<S>) -> Point2<S>`[src]

Performs the `-` operation.

### `impl<'a, S: BaseNum> Sub<&'a Vector2<S>> for Point2<S>`[src]

#### `type Output = Point2<S>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: &'a Vector2<S>) -> Point2<S>`[src]

Performs the `-` operation.

### `impl<'a, S: BaseNum> Sub<Vector2<S>> for &'a Point2<S>`[src]

#### `type Output = Point2<S>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: Vector2<S>) -> Point2<S>`[src]

Performs the `-` operation.

### `impl<'a, 'b, S: BaseNum> Sub<&'a Vector2<S>> for &'b Point2<S>`[src]

#### `type Output = Point2<S>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: &'a Vector2<S>) -> Point2<S>`[src]

Performs the `-` operation.

### `impl<S: BaseFloat> Mul<Vector2<S>> for Matrix2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<S>) -> Vector2<S>`[src]

Performs the `*` operation.

### `impl<'a, S: BaseFloat> Mul<&'a Vector2<S>> for Matrix2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<S>) -> Vector2<S>`[src]

Performs the `*` operation.

### `impl<'a, S: BaseFloat> Mul<Vector2<S>> for &'a Matrix2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<S>) -> Vector2<S>`[src]

Performs the `*` operation.

### `impl<'a, 'b, S: BaseFloat> Mul<&'a Vector2<S>> for &'b Matrix2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<S>) -> Vector2<S>`[src]

Performs the `*` operation.

### `impl<S: BaseNum> Mul<S> for Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: S) -> Vector2<S>`[src]

Performs the `*` operation.

### `impl<'a, S: BaseNum> Mul<S> for &'a Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: S) -> Vector2<S>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<usize>> for usize`[src]

#### `type Output = Vector2<usize>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<usize>) -> Vector2<usize>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<usize>> for usize`[src]

#### `type Output = Vector2<usize>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<usize>) -> Vector2<usize>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<u8>> for u8`[src]

#### `type Output = Vector2<u8>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<u8>) -> Vector2<u8>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<u8>> for u8`[src]

#### `type Output = Vector2<u8>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<u8>) -> Vector2<u8>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<u16>> for u16`[src]

#### `type Output = Vector2<u16>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<u16>) -> Vector2<u16>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<u16>> for u16`[src]

#### `type Output = Vector2<u16>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<u16>) -> Vector2<u16>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<u32>> for u32`[src]

#### `type Output = Vector2<u32>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<u32>) -> Vector2<u32>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<u32>> for u32`[src]

#### `type Output = Vector2<u32>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<u32>) -> Vector2<u32>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<u64>> for u64`[src]

#### `type Output = Vector2<u64>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<u64>) -> Vector2<u64>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<u64>> for u64`[src]

#### `type Output = Vector2<u64>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<u64>) -> Vector2<u64>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<isize>> for isize`[src]

#### `type Output = Vector2<isize>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<isize>) -> Vector2<isize>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<isize>> for isize`[src]

#### `type Output = Vector2<isize>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<isize>) -> Vector2<isize>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<i8>> for i8`[src]

#### `type Output = Vector2<i8>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<i8>) -> Vector2<i8>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<i8>> for i8`[src]

#### `type Output = Vector2<i8>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<i8>) -> Vector2<i8>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<i16>> for i16`[src]

#### `type Output = Vector2<i16>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<i16>) -> Vector2<i16>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<i16>> for i16`[src]

#### `type Output = Vector2<i16>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<i16>) -> Vector2<i16>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<i32>> for i32`[src]

#### `type Output = Vector2<i32>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<i32>) -> Vector2<i32>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<i32>> for i32`[src]

#### `type Output = Vector2<i32>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<i32>) -> Vector2<i32>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<i64>> for i64`[src]

#### `type Output = Vector2<i64>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<i64>) -> Vector2<i64>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<i64>> for i64`[src]

#### `type Output = Vector2<i64>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<i64>) -> Vector2<i64>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<f32>> for f32`[src]

#### `type Output = Vector2<f32>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<f32>) -> Vector2<f32>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<f32>> for f32`[src]

#### `type Output = Vector2<f32>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<f32>) -> Vector2<f32>`[src]

Performs the `*` operation.

### `impl Mul<Vector2<f64>> for f64`[src]

#### `type Output = Vector2<f64>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Vector2<f64>) -> Vector2<f64>`[src]

Performs the `*` operation.

### `impl<'a> Mul<&'a Vector2<f64>> for f64`[src]

#### `type Output = Vector2<f64>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'a Vector2<f64>) -> Vector2<f64>`[src]

Performs the `*` operation.

### `impl<S: BaseNum> Div<S> for Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: S) -> Vector2<S>`[src]

Performs the `/` operation.

### `impl<'a, S: BaseNum> Div<S> for &'a Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: S) -> Vector2<S>`[src]

Performs the `/` operation.

### `impl Div<Vector2<usize>> for usize`[src]

#### `type Output = Vector2<usize>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<usize>) -> Vector2<usize>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<usize>> for usize`[src]

#### `type Output = Vector2<usize>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<usize>) -> Vector2<usize>`[src]

Performs the `/` operation.

### `impl Div<Vector2<u8>> for u8`[src]

#### `type Output = Vector2<u8>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<u8>) -> Vector2<u8>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<u8>> for u8`[src]

#### `type Output = Vector2<u8>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<u8>) -> Vector2<u8>`[src]

Performs the `/` operation.

### `impl Div<Vector2<u16>> for u16`[src]

#### `type Output = Vector2<u16>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<u16>) -> Vector2<u16>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<u16>> for u16`[src]

#### `type Output = Vector2<u16>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<u16>) -> Vector2<u16>`[src]

Performs the `/` operation.

### `impl Div<Vector2<u32>> for u32`[src]

#### `type Output = Vector2<u32>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<u32>) -> Vector2<u32>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<u32>> for u32`[src]

#### `type Output = Vector2<u32>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<u32>) -> Vector2<u32>`[src]

Performs the `/` operation.

### `impl Div<Vector2<u64>> for u64`[src]

#### `type Output = Vector2<u64>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<u64>) -> Vector2<u64>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<u64>> for u64`[src]

#### `type Output = Vector2<u64>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<u64>) -> Vector2<u64>`[src]

Performs the `/` operation.

### `impl Div<Vector2<isize>> for isize`[src]

#### `type Output = Vector2<isize>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<isize>) -> Vector2<isize>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<isize>> for isize`[src]

#### `type Output = Vector2<isize>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<isize>) -> Vector2<isize>`[src]

Performs the `/` operation.

### `impl Div<Vector2<i8>> for i8`[src]

#### `type Output = Vector2<i8>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<i8>) -> Vector2<i8>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<i8>> for i8`[src]

#### `type Output = Vector2<i8>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<i8>) -> Vector2<i8>`[src]

Performs the `/` operation.

### `impl Div<Vector2<i16>> for i16`[src]

#### `type Output = Vector2<i16>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<i16>) -> Vector2<i16>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<i16>> for i16`[src]

#### `type Output = Vector2<i16>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<i16>) -> Vector2<i16>`[src]

Performs the `/` operation.

### `impl Div<Vector2<i32>> for i32`[src]

#### `type Output = Vector2<i32>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<i32>) -> Vector2<i32>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<i32>> for i32`[src]

#### `type Output = Vector2<i32>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<i32>) -> Vector2<i32>`[src]

Performs the `/` operation.

### `impl Div<Vector2<i64>> for i64`[src]

#### `type Output = Vector2<i64>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<i64>) -> Vector2<i64>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<i64>> for i64`[src]

#### `type Output = Vector2<i64>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<i64>) -> Vector2<i64>`[src]

Performs the `/` operation.

### `impl Div<Vector2<f32>> for f32`[src]

#### `type Output = Vector2<f32>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<f32>) -> Vector2<f32>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<f32>> for f32`[src]

#### `type Output = Vector2<f32>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<f32>) -> Vector2<f32>`[src]

Performs the `/` operation.

### `impl Div<Vector2<f64>> for f64`[src]

#### `type Output = Vector2<f64>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Vector2<f64>) -> Vector2<f64>`[src]

Performs the `/` operation.

### `impl<'a> Div<&'a Vector2<f64>> for f64`[src]

#### `type Output = Vector2<f64>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'a Vector2<f64>) -> Vector2<f64>`[src]

Performs the `/` operation.

### `impl<S: BaseNum> Rem<S> for Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: S) -> Vector2<S>`[src]

Performs the `%` operation.

### `impl<'a, S: BaseNum> Rem<S> for &'a Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: S) -> Vector2<S>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<usize>> for usize`[src]

#### `type Output = Vector2<usize>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<usize>) -> Vector2<usize>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<usize>> for usize`[src]

#### `type Output = Vector2<usize>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<usize>) -> Vector2<usize>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<u8>> for u8`[src]

#### `type Output = Vector2<u8>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<u8>) -> Vector2<u8>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<u8>> for u8`[src]

#### `type Output = Vector2<u8>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<u8>) -> Vector2<u8>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<u16>> for u16`[src]

#### `type Output = Vector2<u16>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<u16>) -> Vector2<u16>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<u16>> for u16`[src]

#### `type Output = Vector2<u16>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<u16>) -> Vector2<u16>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<u32>> for u32`[src]

#### `type Output = Vector2<u32>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<u32>) -> Vector2<u32>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<u32>> for u32`[src]

#### `type Output = Vector2<u32>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<u32>) -> Vector2<u32>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<u64>> for u64`[src]

#### `type Output = Vector2<u64>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<u64>) -> Vector2<u64>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<u64>> for u64`[src]

#### `type Output = Vector2<u64>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<u64>) -> Vector2<u64>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<isize>> for isize`[src]

#### `type Output = Vector2<isize>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<isize>) -> Vector2<isize>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<isize>> for isize`[src]

#### `type Output = Vector2<isize>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<isize>) -> Vector2<isize>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<i8>> for i8`[src]

#### `type Output = Vector2<i8>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<i8>) -> Vector2<i8>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<i8>> for i8`[src]

#### `type Output = Vector2<i8>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<i8>) -> Vector2<i8>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<i16>> for i16`[src]

#### `type Output = Vector2<i16>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<i16>) -> Vector2<i16>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<i16>> for i16`[src]

#### `type Output = Vector2<i16>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<i16>) -> Vector2<i16>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<i32>> for i32`[src]

#### `type Output = Vector2<i32>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<i32>) -> Vector2<i32>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<i32>> for i32`[src]

#### `type Output = Vector2<i32>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<i32>) -> Vector2<i32>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<i64>> for i64`[src]

#### `type Output = Vector2<i64>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<i64>) -> Vector2<i64>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<i64>> for i64`[src]

#### `type Output = Vector2<i64>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<i64>) -> Vector2<i64>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<f32>> for f32`[src]

#### `type Output = Vector2<f32>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<f32>) -> Vector2<f32>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<f32>> for f32`[src]

#### `type Output = Vector2<f32>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<f32>) -> Vector2<f32>`[src]

Performs the `%` operation.

### `impl Rem<Vector2<f64>> for f64`[src]

#### `type Output = Vector2<f64>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Vector2<f64>) -> Vector2<f64>`[src]

Performs the `%` operation.

### `impl<'a> Rem<&'a Vector2<f64>> for f64`[src]

#### `type Output = Vector2<f64>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'a Vector2<f64>) -> Vector2<f64>`[src]

Performs the `%` operation.

### `impl<S: Neg<Output = S>> Neg for Vector2<S>`[src]

#### `type Output = Vector2<S>`

The resulting type after applying the `-` operator.

#### `fn neg(self) -> Vector2<S>`[src]

Performs the unary `-` operation.

### `impl<S: BaseNum + AddAssign<S>> AddAssign<Vector2<S>> for Vector2<S>`[src]

#### `fn add_assign(&mut self, other: Vector2<S>)`[src]

Performs the `+=` operation.

### `impl<S: BaseNum + AddAssign<S>> AddAssign<Vector2<S>> for Point2<S>`[src]

#### `fn add_assign(&mut self, vector: Vector2<S>)`[src]

Performs the `+=` operation.

### `impl<S: BaseNum + SubAssign<S>> SubAssign<Vector2<S>> for Vector2<S>`[src]

#### `fn sub_assign(&mut self, other: Vector2<S>)`[src]

Performs the `-=` operation.

### `impl<S: BaseNum + SubAssign<S>> SubAssign<Vector2<S>> for Point2<S>`[src]

#### `fn sub_assign(&mut self, vector: Vector2<S>)`[src]

Performs the `-=` operation.

### `impl<S: BaseNum + MulAssign<S>> MulAssign<S> for Vector2<S>`[src]

#### `fn mul_assign(&mut self, scalar: S)`[src]

Performs the `*=` operation.

### `impl<S: BaseNum + DivAssign<S>> DivAssign<S> for Vector2<S>`[src]

#### `fn div_assign(&mut self, scalar: S)`[src]

Performs the `/=` operation.

### `impl<S: BaseNum + RemAssign<S>> RemAssign<S> for Vector2<S>`[src]

#### `fn rem_assign(&mut self, scalar: S)`[src]

Performs the `%=` operation.

### `impl<S> Index<usize> for Vector2<S>`[src]

#### `type Output = S`

The returned type after indexing.

#### `fn index<'a>(&'a self, i: usize) -> &'a S`[src]

Performs the indexing (`container[index]`) operation.

### `impl<S> Index<Range<usize>> for Vector2<S>`[src]

#### `type Output = [S]`

The returned type after indexing.

#### `fn index<'a>(&'a self, i: Range<usize>) -> &'a [S]`[src]

Performs the indexing (`container[index]`) operation.

### `impl<S> Index<RangeTo<usize>> for Vector2<S>`[src]

#### `type Output = [S]`

The returned type after indexing.

#### `fn index<'a>(&'a self, i: RangeTo<usize>) -> &'a [S]`[src]

Performs the indexing (`container[index]`) operation.

### `impl<S> Index<RangeFrom<usize>> for Vector2<S>`[src]

#### `type Output = [S]`

The returned type after indexing.

#### `fn index<'a>(&'a self, i: RangeFrom<usize>) -> &'a [S]`[src]

Performs the indexing (`container[index]`) operation.

### `impl<S> Index<RangeFull> for Vector2<S>`[src]

#### `type Output = [S]`

The returned type after indexing.

#### `fn index<'a>(&'a self, i: RangeFull) -> &'a [S]`[src]

Performs the indexing (`container[index]`) operation.

### `impl<S> IndexMut<usize> for Vector2<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut S`[src]

Performs the mutable indexing (`container[index]`) operation.

### `impl<S> IndexMut<Range<usize>> for Vector2<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: Range<usize>) -> &'a mut [S]`[src]

Performs the mutable indexing (`container[index]`) operation.

### `impl<S> IndexMut<RangeTo<usize>> for Vector2<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: RangeTo<usize>) -> &'a mut [S]`[src]

Performs the mutable indexing (`container[index]`) operation.

### `impl<S> IndexMut<RangeFrom<usize>> for Vector2<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: RangeFrom<usize>) -> &'a mut [S]`[src]

Performs the mutable indexing (`container[index]`) operation.

### `impl<S> IndexMut<RangeFull> for Vector2<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: RangeFull) -> &'a mut [S]`[src]

Performs the mutable indexing (`container[index]`) operation.

### `impl<S: Debug> Debug for Vector2<S>`[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result`[src]

Formats the value using the given formatter. Read more

### `impl<S: BaseNum> Sum<Vector2<S>> for Vector2<S>`[src]

#### `fn sum<I: Iterator<Item = Vector2<S>>>(iter: I) -> Vector2<S>`[src]

Method which takes an iterator and generates `Self` from the elements by "summing up" the items. Read more

### `impl<'a, S: 'a + BaseNum> Sum<&'a Vector2<S>> for Vector2<S>`[src]

#### `fn sum<I: Iterator<Item = &'a Vector2<S>>>(iter: I) -> Vector2<S>`[src]

Method which takes an iterator and generates `Self` from the elements by "summing up" the items. Read more

### `impl<S: BaseFloat> AbsDiffEq<Vector2<S>> for Vector2<S>`[src]

#### `type Epsilon = S::Epsilon`

Used for specifying relative comparisons.

#### `fn default_epsilon() -> S::Epsilon`[src]

The default tolerance to use when testing values that are close together. Read more

#### `fn abs_diff_eq(&self, other: &Self, epsilon: S::Epsilon) -> bool`[src]

A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more

#### `fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool`[src]

The inverse of `ApproxEq::abs_diff_eq`.

### `impl<S: BaseFloat> RelativeEq<Vector2<S>> for Vector2<S>`[src]

#### `fn default_max_relative() -> S::Epsilon`[src]

The default relative tolerance for testing values that are far-apart. Read more

#### `fn relative_eq(
&self,
other: &Self,
epsilon: S::Epsilon,
max_relative: S::Epsilon
) -> bool`[src]

A test for equality that uses a relative comparison if the values are far apart.

#### `fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool`[src]

The inverse of `ApproxEq::relative_eq`.

### `impl<S: BaseFloat> UlpsEq<Vector2<S>> for Vector2<S>`[src]

#### `fn default_max_ulps() -> u32`[src]

The default ULPs to tolerate when testing values that are far-apart. Read more

#### `fn ulps_eq(&self, other: &Self, epsilon: S::Epsilon, max_ulps: u32) -> bool`[src]

A test for equality that uses units in the last place (ULP) if the values are far apart.

#### `fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool`[src]

The inverse of `ApproxEq::ulps_eq`.

### `impl<S: Bounded> Bounded for Vector2<S>`[src]

#### `fn min_value() -> Vector2<S>`[src]

returns the smallest finite number this type can represent

#### `fn max_value() -> Vector2<S>`[src]

returns the largest finite number this type can represent

### `impl<S: BaseNum> Zero for Vector2<S>`[src]

#### `fn zero() -> Vector2<S>`[src]

Returns the additive identity element of `Self`, `0`. # Purity Read more

#### `fn is_zero(&self) -> bool`[src]

Returns `true` if `self` is equal to the additive identity.

#### `fn set_zero(&mut self)`[src]

Sets `self` to the additive identity element of `Self`, `0`.

### `impl<S> Distribution<Vector2<S>> for Standard where
Standard: Distribution<S>,
S: BaseFloat,` [src]

#### `fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vector2<S>`[src]

Generate a random value of `T`, using `rng` as the source of randomness.

#### `fn sample_iter<R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
R: Rng,` [src]

Create an iterator that generates random values of `T`, using `rng` as the source of randomness. Read more

## Auto Trait Implementations

### `impl<S> Send for Vector2<S> where
S: Send,`

### `impl<S> Unpin for Vector2<S> where
S: Unpin,`

### `impl<S> Sync for Vector2<S> where
S: Sync,`

### `impl<S> UnwindSafe for Vector2<S> where
S: UnwindSafe,`

### `impl<S> RefUnwindSafe for Vector2<S> where
S: RefUnwindSafe,`

## Blanket Implementations

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

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `fn to_owned(&self) -> T`[src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `fn clone_into(&self, target: &mut T)`[src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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

#### `fn into(self) -> U`[src]

Performs the conversion.

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

#### `fn from(t: T) -> T`[src]

Performs the conversion.

### `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.

#### `fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`[src]

Performs the conversion.

### `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.

#### `fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>`[src]

Performs the conversion.

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

#### `fn borrow_mut(&mut self) -> &mut T`[src]

Mutably borrows from an owned value. Read more

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

#### `fn borrow(&self) -> &T`[src]

Immutably borrows from an owned value. Read more

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

#### `fn type_id(&self) -> TypeId`[src]

Gets the `TypeId` of `self`. Read more

### `impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,` [src]

### `impl<T, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,` [src]

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)