Struct Vector2

Source
pub struct Vector2<T> {
    pub x_: T,
    pub y_: T,
}
Expand description

The Vector2 struct represents a 2-dimensional vector with elements of type T.

Properties:

  • x_: The x_ property represents the first element of the Vector2 object. It is of type T, which means it can be any type that is specified when creating an instance of Vector2.
  • y_: The y_ property is the second element of the Vector2 object. It represents the y-coordinate of a 2D vector.

§Examples:

use ginger::vector2::Vector2;

assert_eq!(Vector2::new(3, 4), Vector2 { x_: 3, y_: 4});

Fields§

§x_: T

The first element of the vector2 object

§y_: T

The second element of the vector2 object

Implementations§

Source§

impl<T> Vector2<T>

Source

pub const fn new(x_: T, y_: T) -> Self

Creates a new Vector2<T>.

The new function creates a new Vector2 instance with the given x and y values.

Arguments:

  • x_: The parameter x_ represents the x-coordinate of the vector. It is of type T, which means it can be any type that implements the necessary operations for vector calculations (e.g., addition, subtraction, multiplication).
  • y_: The y_ parameter represents the y-coordinate of the vector.

Returns:

The new function returns a new instance of the Vector2<T> struct.

§Examples
use ginger::vector2::Vector2;

assert_eq!(Vector2::new(3, 4), Vector2 { x_: 3, y_: 4});
Source§

impl<T: Clone + Num> Vector2<T>

Source

pub fn dot(&self, other: &Self) -> T

The dot function calculates the dot product of two vectors.

Arguments:

  • other: The other parameter is a reference to another Vector2 object that we want to calculate the dot product with.

Returns:

The dot product of two vectors is being returned.

§Examples
use ginger::vector2::Vector2;

let vector2 = &Vector2::new(3, 4);
let other = &Vector2::new(5, 6);
assert_eq!(vector2.dot(other), 15 + 24);
assert_eq!(vector2.dot(&vector2), 9 + 16);
Source

pub fn cross(&self, other: &Self) -> T

The cross function calculates the cross product of two vectors.

Arguments:

  • other: The other parameter is a reference to another Vector2 object that we want to calculate the cross product with.

Returns:

The cross product of two vectors is being returned.

§Examples
use ginger::vector2::Vector2;

let vector2 = &Vector2::new(3, 4);
let other = &Vector2::new(5, 6);
assert_eq!(vector2.cross(other), 18 - 20);
assert_eq!(vector2.cross(&vector2), 0);
Source

pub fn norm_sqr(&self) -> T

Returns the norm sqr of this Vector2<T>.

The norm_sqr function calculates the squared norm of a Vector2 object.

Returns:

The norm_sqr function returns the squared norm of the Vector2<T>.

§Examples
use ginger::vector2::Vector2;

let vector2 = &Vector2::new(3, 4);
assert_eq!(vector2.norm_sqr(), 9 + 16);
Source

pub fn scale(&self, alpha: T) -> Self

The scale function multiplies the x and y components of a Vector2 object by a given scalar value.

Arguments:

  • alpha: The parameter alpha represents the scaling factor that will be applied to the vector.

Returns:

The scale method returns a new Vector2 object.

§Examples
use ginger::vector2::Vector2;

let vector2 = &Vector2::new(3.0, 4.0);
assert_eq!(vector2.scale(10.0), Vector2::new(30.0, 40.0));
assert_eq!(vector2.scale(0.5), Vector2::new(1.5, 2.0));
Source

pub fn unscale(&self, alpha: T) -> Self

The unscale function divides the x and y components of a Vector2 by a given value.

Arguments:

  • alpha: The alpha parameter is a value of type T that is used to divide the x_ and y_ values of the Vector2 object.

Returns:

The unscale method returns a new Vector2 object.

§Examples
use ginger::vector2::Vector2;

let vector2 = &Vector2::new(30, 40);
assert_eq!(vector2.unscale(10), Vector2::new(3, 4));
Source§

impl<T: Clone + Signed> Vector2<T>

Source

pub fn l1_norm(&self) -> T

The l1_norm function calculates the Manhattan distance from the origin for a 2D vector.

Returns:

The function l1_norm returns the L1 norm of a Vector2 object, which is the sum of the absolute values of its x_ and y_ components.

§Examples
use ginger::vector2::Vector2;

let vector2 = &Vector2::new(3, -4);
assert_eq!(vector2.l1_norm(), 7);
Source§

impl<T: Clone + PartialOrd> Vector2<T>

Source

pub fn norm_inf(&self) -> T

The norm_inf function returns the maximum absolute value of the two elements in a Vector2 object.

Returns:

The norm_inf function returns the maximum value between self.x_ and self.y_.

§Examples
use ginger::vector2::Vector2;

let vector2 = &Vector2::new(3, -4);
assert_eq!(vector2.norm_inf(), 3);

Trait Implementations§

Source§

impl<'a, 'b, T: Clone + Num> Add<&'b Vector2<T>> for &'a Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Vector2<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T: Clone + Num> Add<&'a Vector2<T>> for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Vector2<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T: Clone + Num> Add<Vector2<T>> for &'a Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Vector2<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Clone + Num> Add for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T: Clone + NumAssign> AddAssign<&'a Vector2<T>> for Vector2<T>

Source§

fn add_assign(&mut self, other: &Self)

Performs the += operation. Read more
Source§

impl<T: Clone + NumAssign> AddAssign for Vector2<T>

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Vector2<T>

Source§

fn clone(&self) -> Vector2<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Vector2<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for Vector2<T>

Source§

fn default() -> Vector2<T>

Returns the “default value” for a type. Read more
Source§

impl<T: Clone + Num> Div<T> for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a, T: Clone + NumAssign> DivAssign<&'a T> for Vector2<T>

Source§

fn div_assign(&mut self, other: &T)

Performs the /= operation. Read more
Source§

impl<T: Clone + NumAssign> DivAssign<T> for Vector2<T>

Source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
Source§

impl<T: Hash> Hash for Vector2<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, 'b, T: Clone + Num> Mul<&'a T> for &'b Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &T) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, T: Clone + Num> Mul<&'a T> for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &T) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<f32>> for &'b f32

Source§

type Output = Vector2<f32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<f32>) -> Vector2<f32>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<f32>> for f32

Source§

type Output = Vector2<f32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<f32>) -> Vector2<f32>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<f64>> for &'b f64

Source§

type Output = Vector2<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<f64>) -> Vector2<f64>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<f64>> for f64

Source§

type Output = Vector2<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<f64>) -> Vector2<f64>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<i128>> for &'b i128

Source§

type Output = Vector2<i128>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i128>) -> Vector2<i128>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<i128>> for i128

Source§

type Output = Vector2<i128>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i128>) -> Vector2<i128>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<i16>> for &'b i16

Source§

type Output = Vector2<i16>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i16>) -> Vector2<i16>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<i16>> for i16

Source§

type Output = Vector2<i16>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i16>) -> Vector2<i16>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<i32>> for &'b i32

Source§

type Output = Vector2<i32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i32>) -> Vector2<i32>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<i32>> for i32

Source§

type Output = Vector2<i32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i32>) -> Vector2<i32>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<i64>> for &'b i64

Source§

type Output = Vector2<i64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i64>) -> Vector2<i64>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<i64>> for i64

Source§

type Output = Vector2<i64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i64>) -> Vector2<i64>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<i8>> for &'b i8

Source§

type Output = Vector2<i8>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i8>) -> Vector2<i8>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<i8>> for i8

Source§

type Output = Vector2<i8>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<i8>) -> Vector2<i8>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<isize>> for &'b isize

Source§

type Output = Vector2<isize>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<isize>) -> Vector2<isize>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<isize>> for isize

Source§

type Output = Vector2<isize>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<isize>) -> Vector2<isize>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<u128>> for &'b u128

Source§

type Output = Vector2<u128>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u128>) -> Vector2<u128>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<u128>> for u128

Source§

type Output = Vector2<u128>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u128>) -> Vector2<u128>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<u16>> for &'b u16

Source§

type Output = Vector2<u16>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u16>) -> Vector2<u16>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<u16>> for u16

Source§

type Output = Vector2<u16>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u16>) -> Vector2<u16>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<u32>> for &'b u32

Source§

type Output = Vector2<u32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u32>) -> Vector2<u32>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<u32>> for u32

Source§

type Output = Vector2<u32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u32>) -> Vector2<u32>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<u64>> for &'b u64

Source§

type Output = Vector2<u64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u64>) -> Vector2<u64>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<u64>> for u64

Source§

type Output = Vector2<u64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u64>) -> Vector2<u64>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<u8>> for &'b u8

Source§

type Output = Vector2<u8>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u8>) -> Vector2<u8>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<u8>> for u8

Source§

type Output = Vector2<u8>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<u8>) -> Vector2<u8>

Performs the * operation. Read more
Source§

impl<'a, 'b> Mul<&'a Vector2<usize>> for &'b usize

Source§

type Output = Vector2<usize>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<usize>) -> Vector2<usize>

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Vector2<usize>> for usize

Source§

type Output = Vector2<usize>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Vector2<usize>) -> Vector2<usize>

Performs the * operation. Read more
Source§

impl<'a, T: Clone + Num> Mul<T> for &'a Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Clone + Num> Mul<T> for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<f32>> for &'a f32

Source§

type Output = Vector2<f32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<f32>) -> Vector2<f32>

Performs the * operation. Read more
Source§

impl Mul<Vector2<f32>> for f32

Source§

type Output = Vector2<f32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<f32>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<f64>> for &'a f64

Source§

type Output = Vector2<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<f64>) -> Vector2<f64>

Performs the * operation. Read more
Source§

impl Mul<Vector2<f64>> for f64

Source§

type Output = Vector2<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<f64>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<i128>> for &'a i128

Source§

type Output = Vector2<i128>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i128>) -> Vector2<i128>

Performs the * operation. Read more
Source§

impl Mul<Vector2<i128>> for i128

Source§

type Output = Vector2<i128>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i128>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<i16>> for &'a i16

Source§

type Output = Vector2<i16>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i16>) -> Vector2<i16>

Performs the * operation. Read more
Source§

impl Mul<Vector2<i16>> for i16

Source§

type Output = Vector2<i16>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i16>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<i32>> for &'a i32

Source§

type Output = Vector2<i32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i32>) -> Vector2<i32>

Performs the * operation. Read more
Source§

impl Mul<Vector2<i32>> for i32

Source§

type Output = Vector2<i32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i32>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<i64>> for &'a i64

Source§

type Output = Vector2<i64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i64>) -> Vector2<i64>

Performs the * operation. Read more
Source§

impl Mul<Vector2<i64>> for i64

Source§

type Output = Vector2<i64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i64>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<i8>> for &'a i8

Source§

type Output = Vector2<i8>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i8>) -> Vector2<i8>

Performs the * operation. Read more
Source§

impl Mul<Vector2<i8>> for i8

Source§

type Output = Vector2<i8>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<i8>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<isize>> for &'a isize

Source§

type Output = Vector2<isize>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<isize>) -> Vector2<isize>

Performs the * operation. Read more
Source§

impl Mul<Vector2<isize>> for isize

Source§

type Output = Vector2<isize>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<isize>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<u128>> for &'a u128

Source§

type Output = Vector2<u128>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u128>) -> Vector2<u128>

Performs the * operation. Read more
Source§

impl Mul<Vector2<u128>> for u128

Source§

type Output = Vector2<u128>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u128>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<u16>> for &'a u16

Source§

type Output = Vector2<u16>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u16>) -> Vector2<u16>

Performs the * operation. Read more
Source§

impl Mul<Vector2<u16>> for u16

Source§

type Output = Vector2<u16>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u16>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<u32>> for &'a u32

Source§

type Output = Vector2<u32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u32>) -> Vector2<u32>

Performs the * operation. Read more
Source§

impl Mul<Vector2<u32>> for u32

Source§

type Output = Vector2<u32>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u32>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<u64>> for &'a u64

Source§

type Output = Vector2<u64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u64>) -> Vector2<u64>

Performs the * operation. Read more
Source§

impl Mul<Vector2<u64>> for u64

Source§

type Output = Vector2<u64>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u64>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<u8>> for &'a u8

Source§

type Output = Vector2<u8>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u8>) -> Vector2<u8>

Performs the * operation. Read more
Source§

impl Mul<Vector2<u8>> for u8

Source§

type Output = Vector2<u8>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<u8>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Vector2<usize>> for &'a usize

Source§

type Output = Vector2<usize>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<usize>) -> Vector2<usize>

Performs the * operation. Read more
Source§

impl Mul<Vector2<usize>> for usize

Source§

type Output = Vector2<usize>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Vector2<usize>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, T: Clone + NumAssign> MulAssign<&'a T> for Vector2<T>

Source§

fn mul_assign(&mut self, other: &T)

Performs the *= operation. Read more
Source§

impl<T: Clone + NumAssign> MulAssign<T> for Vector2<T>

Source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
Source§

impl<'a, T: Clone + Num + Neg<Output = T>> Neg for &'a Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T: Clone + Num + Neg<Output = T>> Neg for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T: PartialEq> PartialEq for Vector2<T>

Source§

fn eq(&self, other: &Vector2<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Clone + Num> Rem<T> for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the % operator.
Source§

fn rem(self, other: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a, 'b, T: Clone + Num> Sub<&'b Vector2<T>> for &'a Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Vector2<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T: Clone + Num> Sub<&'a Vector2<T>> for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Vector2<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T: Clone + Num> Sub<Vector2<T>> for &'a Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Vector2<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Clone + Num> Sub for Vector2<T>

Source§

type Output = Vector2<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T: Clone + NumAssign> SubAssign<&'a Vector2<T>> for Vector2<T>

Source§

fn sub_assign(&mut self, other: &Self)

Performs the -= operation. Read more
Source§

impl<T: Clone + NumAssign> SubAssign for Vector2<T>

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<T: Clone + Num> Zero for Vector2<T>

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

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

impl<T: Copy> Copy for Vector2<T>

Source§

impl<T: Eq> Eq for Vector2<T>

Source§

impl<T> StructuralPartialEq for Vector2<T>

Auto Trait Implementations§

§

impl<T> Freeze for Vector2<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Vector2<T>
where T: RefUnwindSafe,

§

impl<T> Send for Vector2<T>
where T: Send,

§

impl<T> Sync for Vector2<T>
where T: Sync,

§

impl<T> Unpin for Vector2<T>
where T: Unpin,

§

impl<T> UnwindSafe for Vector2<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.