#[repr(C)]pub struct Vector2<T: Unit = f32> {
pub x: T::Scalar,
pub y: T::Scalar,
}
Expand description
2D vector.
Bitwise compatible with glam::Vec2
/ glam::DVec2
/ glam::IVec2
Alignment: Same as the scalar.
Fields§
§x: T::Scalar
X coordinate
y: T::Scalar
Y coordinate
Implementations§
source§impl<T: Unit> Vector2<T>
impl<T: Unit> Vector2<T>
sourcepub fn from_array(array: [T::Scalar; 2]) -> Self
pub fn from_array(array: [T::Scalar; 2]) -> Self
Instantiate from array.
See glam::Vec2::from_array()
.
sourcepub fn to_array(self) -> [T::Scalar; 2]
pub fn to_array(self) -> [T::Scalar; 2]
Convert to array.
See glam::Vec2::to_array()
.
sourcepub fn splat(scalar: T::Scalar) -> Self
pub fn splat(scalar: T::Scalar) -> Self
Instance with all components set to scalar
.
See glam::Vec2::splat()
.
sourcepub fn write_to_slice(self, slice: &mut [T::Scalar])
pub fn write_to_slice(self, slice: &mut [T::Scalar])
Write all components to slice.
sourcepub fn cmpeq(self, other: Self) -> BVec2
pub fn cmpeq(self, other: Self) -> BVec2
Return a mask with the result of a component-wise equals comparison.
See glam::Vec2::cmpeq()
.
sourcepub fn cmpne(self, other: Self) -> BVec2
pub fn cmpne(self, other: Self) -> BVec2
Return a mask with the result of a component-wise not-equal comparison.
See glam::Vec2::cmpne()
.
sourcepub fn cmpge(self, other: Self) -> BVec2
pub fn cmpge(self, other: Self) -> BVec2
Return a mask with the result of a component-wise greater-than-or-equal comparison.
See glam::Vec2::cmpge()
.
sourcepub fn cmpgt(self, other: Self) -> BVec2
pub fn cmpgt(self, other: Self) -> BVec2
Return a mask with the result of a component-wise greater-than comparison.
See glam::Vec2::cmpgt()
.
sourcepub fn cmple(self, other: Self) -> BVec2
pub fn cmple(self, other: Self) -> BVec2
Return a mask with the result of a component-wise less-than-or-equal comparison.
See glam::Vec2::cmple()
.
sourcepub fn cmplt(self, other: Self) -> BVec2
pub fn cmplt(self, other: Self) -> BVec2
Return a mask with the result of a component-wise less-than comparison.
See glam::Vec2::cmplt()
.
sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Minimum by component.
See glam::Vec2::min()
.
sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Maximum by component.
See glam::Vec2::max()
.
sourcepub fn min_element(self) -> T::Scalar
pub fn min_element(self) -> T::Scalar
Horizontal minimum (smallest component).
See glam::Vec2::min_element()
.
sourcepub fn max_element(self) -> T::Scalar
pub fn max_element(self) -> T::Scalar
Horizontal maximum (largest component).
See glam::Vec2::max_element()
.
sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Component-wise clamp.
See glam::Vec2::clamp()
.
sourcepub fn select(mask: BVec2, a: Self, b: Self) -> Self
pub fn select(mask: BVec2, a: Self, b: Self) -> Self
Select components from two instances based on a mask.
See glam::Vec2::select()
.
sourcepub fn from_untyped(untyped: Vector2<T::Scalar>) -> Vector2<T>
pub fn from_untyped(untyped: Vector2<T::Scalar>) -> Vector2<T>
Bitcast an untyped instance to self.
sourcepub fn to_untyped(self) -> Vector2<T::Scalar>
pub fn to_untyped(self) -> Vector2<T::Scalar>
Bitcast self to an untyped instance.
sourcepub fn as_untyped(&self) -> &Vector2<T::Scalar>
pub fn as_untyped(&self) -> &Vector2<T::Scalar>
Reinterpret cast self as the untyped variant.
sourcepub fn as_untyped_mut(&mut self) -> &mut Vector2<T::Scalar>
pub fn as_untyped_mut(&mut self) -> &mut Vector2<T::Scalar>
Reinterpret cast self as the untyped variant.
sourcepub fn cast<T2>(self) -> Vector2<T2>
pub fn cast<T2>(self) -> Vector2<T2>
Cast to a different coordinate space with the same underlying scalar type.
sourcepub fn cast_ref<T2>(&self) -> &Vector2<T2>
pub fn cast_ref<T2>(&self) -> &Vector2<T2>
Cast to a different coordinate space with the same underlying scalar type.
sourcepub fn cast_mut<T2>(&mut self) -> &mut Vector2<T2>
pub fn cast_mut<T2>(&mut self) -> &mut Vector2<T2>
Cast to a different coordinate space with the same underlying scalar type.
sourcepub fn try_cast<T2>(self) -> Option<Vector2<T2>>where
T2: Unit,
pub fn try_cast<T2>(self) -> Option<Vector2<T2>>where
T2: Unit,
Cast to a different coordinate space with scalar type conversion. Returns None
if any component could not be converted to the target scalar type.
sourcepub const fn from_tuple((x, y): (T::Scalar, T::Scalar)) -> Self
pub const fn from_tuple((x, y): (T::Scalar, T::Scalar)) -> Self
Instantiate from tuple.
sourcepub fn as_array_mut(&mut self) -> &mut [T::Scalar; 2]
pub fn as_array_mut(&mut self) -> &mut [T::Scalar; 2]
Reinterpret as mutable array.
sourcepub fn dot(self, other: Self) -> T::Scalar
pub fn dot(self, other: Self) -> T::Scalar
Dot product
See glam::Vec2::dot()
.
sourcepub fn extend(self, z: T::Scalar) -> Vector3<T>
pub fn extend(self, z: T::Scalar) -> Vector3<T>
Extend with z-component to Vector3
.
See glam::Vec2::extend()
.
sourcepub fn with_x(self, x: T::Scalar) -> Self
pub fn with_x(self, x: T::Scalar) -> Self
Replace the x-component with a new value.
See glam::Vec2::with_x()
.
sourcepub fn with_y(self, y: T::Scalar) -> Self
pub fn with_y(self, y: T::Scalar) -> Self
Replace the y-component with a new value.
See glam::Vec2::with_y()
.
sourcepub fn element_sum(self) -> T::Scalar
pub fn element_sum(self) -> T::Scalar
Returns the sum of all elements of self.
See glam::Vec2::element_sum()
.
sourcepub fn element_product(self) -> T::Scalar
pub fn element_product(self) -> T::Scalar
Returns the product of all elements of self.
See glam::Vec2::element_product()
.
sourcepub fn swizzle<const X: usize, const Y: usize>(&self) -> Self
pub fn swizzle<const X: usize, const Y: usize>(&self) -> Self
Select components of this vector and return a new vector containing those components.
sourcepub fn from_point(point: Point2<T>) -> Self
pub fn from_point(point: Point2<T>) -> Self
Instantiate from point.
sourcepub fn as_point_mut(&mut self) -> &mut Point2<T>
pub fn as_point_mut(&mut self) -> &mut Point2<T>
Reinterpret as point.
sourcepub fn as_size_mut(&mut self) -> &mut Size2<T>
pub fn as_size_mut(&mut self) -> &mut Size2<T>
Reinterpret as size.
source§impl<T> Vector2<T>
impl<T> Vector2<T>
sourcepub const NEG_INFINITY: Self = _
pub const NEG_INFINITY: Self = _
All negative infinity.
sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
True if all components are non-infinity and non-NaN.
See glam::Vec2::is_finite()
.
sourcepub fn is_nan(&self) -> bool
pub fn is_nan(&self) -> bool
True if any component is NaN.
See glam::Vec2::is_nan()
.
sourcepub fn is_nan_mask(&self) -> BVec2
pub fn is_nan_mask(&self) -> BVec2
Return a mask where each bit is set if the corresponding component is NaN.
See glam::Vec2::is_nan_mask()
.
sourcepub fn ceil(self) -> Self
pub fn ceil(self) -> Self
Round all components up.
See glam::Vec2::ceil()
.
sourcepub fn floor(self) -> Self
pub fn floor(self) -> Self
Round all components down.
See glam::Vec2::floor()
.
sourcepub fn round(self) -> Self
pub fn round(self) -> Self
Round all components.
See glam::Vec2::round()
.
sourcepub fn fract(self) -> Self
pub fn fract(self) -> Self
See (e.g.) glam::Vec2::fract()
See glam::Vec2::fract()
.
sourcepub fn fract_gl(self) -> Self
pub fn fract_gl(self) -> Self
See (e.g.) glam::Vec2::fract_gl()
See glam::Vec2::fract_gl()
.
sourcepub fn lerp(self, other: Self, t: T::Scalar) -> Self
pub fn lerp(self, other: Self, t: T::Scalar) -> Self
Linear interpolation.
See glam::Vec2::lerp()
.
sourcepub fn normalize(self) -> Self
pub fn normalize(self) -> Self
Normalize the vector. Undefined results in the vector’s length is (very close to) zero.
See glam::Vec2::normalize()
.
sourcepub fn normalize_or_zero(self) -> Self
pub fn normalize_or_zero(self) -> Self
Normalize the vector, returning zero if the length was already (very close to) zero.
See glam::Vec2::normalize_or_zero()
.
sourcepub fn normalize_or(self, fallback: Self) -> Self
pub fn normalize_or(self, fallback: Self) -> Self
Returns self normalized to length 1.0 if possible, else returns a fallback value.
See glam::Vec2::normalize_or()
.
sourcepub fn try_normalize(self) -> Option<Self>
pub fn try_normalize(self) -> Option<Self>
Normalize the vector, returning None
if the length was already (very close to) zero.
See glam::Vec2::try_normalize()
.
sourcepub fn is_normalized(self) -> bool
pub fn is_normalized(self) -> bool
True if the vector is normalized.
See glam::Vec2::is_normalized()
.
sourcepub fn length(self) -> T::Scalar
pub fn length(self) -> T::Scalar
Length of the vector
See glam::Vec2::length()
.
sourcepub fn length_squared(self) -> T::Scalar
pub fn length_squared(self) -> T::Scalar
Squared length of the vector
See glam::Vec2::length_squared()
.
sourcepub fn length_recip(self) -> T::Scalar
pub fn length_recip(self) -> T::Scalar
Reciprocal length of the vector
See glam::Vec2::length_recip()
.
sourcepub fn exp(self) -> Self
pub fn exp(self) -> Self
e^self by component
See glam::Vec2::exp()
.
sourcepub fn powf(self, n: T::Scalar) -> Self
pub fn powf(self, n: T::Scalar) -> Self
self^n by component
See glam::Vec2::powf()
.
sourcepub fn recip(self) -> Self
pub fn recip(self) -> Self
1.0/self by component
See glam::Vec2::recip()
.
sourcepub fn mul_add(self, a: Self, b: Self) -> Self
pub fn mul_add(self, a: Self, b: Self) -> Self
self * a + b
See glam::Vec2::mul_add()
.
sourcepub fn clamp_length(self, min: T::Scalar, max: T::Scalar) -> Self
pub fn clamp_length(self, min: T::Scalar, max: T::Scalar) -> Self
Clamp length
See glam::Vec2::clamp_length()
.
sourcepub fn clamp_length_min(self, min: T::Scalar) -> Self
pub fn clamp_length_min(self, min: T::Scalar) -> Self
Clamp length
See glam::Vec2::clamp_length_min()
.
sourcepub fn clamp_length_max(self, max: T::Scalar) -> Self
pub fn clamp_length_max(self, max: T::Scalar) -> Self
Clamp length
See glam::Vec2::clamp_length_max()
.
sourcepub fn project_onto(self, other: Self) -> Self
pub fn project_onto(self, other: Self) -> Self
See (e.g.) glam::Vec2::project_onto()
See glam::Vec2::project_onto()
.
sourcepub fn reject_from(self, other: Self) -> Self
pub fn reject_from(self, other: Self) -> Self
See (e.g.) glam::Vec2::reject_from()
See glam::Vec2::reject_from()
.
sourcepub fn project_onto_normalized(self, other: Self) -> Self
pub fn project_onto_normalized(self, other: Self) -> Self
sourcepub fn reject_from_normalized(self, other: Self) -> Self
pub fn reject_from_normalized(self, other: Self) -> Self
sourcepub fn from_angle(angle: Angle<T::Scalar>) -> Vector2<T::Scalar>
pub fn from_angle(angle: Angle<T::Scalar>) -> Vector2<T::Scalar>
Return (sin(angle), cos(angle)
.
See glam::Vec2::from_angle()
.
sourcepub fn rotate(self, rotation: Vector2<T::Scalar>) -> Self
pub fn rotate(self, rotation: Vector2<T::Scalar>) -> Self
Rotate by a vector containing (sin(angle), cos(angle))
See glam::Vec2::rotate()
.
sourcepub fn to_angle(self) -> Angle<T::Scalar>
pub fn to_angle(self) -> Angle<T::Scalar>
Returns the angle (in radians) of this vector in the range [-π, +π].
See glam::Vec2::to_angle()
.
sourcepub fn angle_between(self, other: Self) -> Angle<T::Scalar>
pub fn angle_between(self, other: Self) -> Angle<T::Scalar>
Angle between this and another vector.
See glam::Vec2::angle_between()
.
source§impl<T> Vector2<T>
impl<T> Vector2<T>
sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Returns a vector containing the saturating addition of self and rhs.
See glam::IVec2::saturating_add()
.
sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Returns a vector containing the saturating subtraction of self and rhs.
See glam::IVec2::saturating_sub()
.
sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Returns a vector containing the saturating multiplication of self and rhs.
See glam::IVec2::saturating_mul()
.
sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Returns a vector containing the saturating division of self and rhs.
See glam::IVec2::saturating_div()
.
sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Returns a vector containing the wrapping addition of self and rhs.
See glam::IVec2::wrapping_add()
.
sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Returns a vector containing the wrapping subtraction of self and rhs.
See glam::IVec2::wrapping_sub()
.
sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Returns a vector containing the wrapping multiplication of self and rhs.
See glam::IVec2::wrapping_mul()
.
sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Returns a vector containing the wrapping division of self and rhs.
See glam::IVec2::wrapping_div()
.
source§impl<T> Vector2<T>
impl<T> Vector2<T>
sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Turn all components positive.
See glam::Vec2::abs()
.
sourcepub fn signum(self) -> Self
pub fn signum(self) -> Self
Return a vector where each component is 1 or -1 depending on the sign of the input.
See glam::Vec2::signum()
.
sourcepub fn perp(self) -> Self
pub fn perp(self) -> Self
Get the perpendicular vector.
See glam::Vec2::perp()
.
sourcepub fn perp_dot(self, other: Self) -> T::Scalar
pub fn perp_dot(self, other: Self) -> T::Scalar
Perpendicular dot product
See glam::Vec2::perp_dot()
.
Trait Implementations§
source§impl<T: Unit> AbsDiffEq for Vector2<T>
impl<T: Unit> AbsDiffEq for Vector2<T>
§type Epsilon = <<T as Unit>::Scalar as AbsDiffEq>::Epsilon
type Epsilon = <<T as Unit>::Scalar as AbsDiffEq>::Epsilon
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
source§fn abs_diff_ne(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Self, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq
.source§impl<T: Unit> AddAssign<Vector2<T>> for Box2<T>
impl<T: Unit> AddAssign<Vector2<T>> for Box2<T>
source§fn add_assign(&mut self, rhs: Vector2<T>)
fn add_assign(&mut self, rhs: Vector2<T>)
+=
operation. Read moresource§impl<T: Unit> AddAssign<Vector2<T>> for Point2<T>
impl<T: Unit> AddAssign<Vector2<T>> for Point2<T>
source§fn add_assign(&mut self, other: Vector2<T>)
fn add_assign(&mut self, other: Vector2<T>)
+=
operation. Read moresource§impl<T: Unit<Scalar = f32>> AddAssign<f32> for Vector2<T>
impl<T: Unit<Scalar = f32>> AddAssign<f32> for Vector2<T>
source§fn add_assign(&mut self, other: f32)
fn add_assign(&mut self, other: f32)
+=
operation. Read moresource§impl<T: Unit<Scalar = f64>> AddAssign<f64> for Vector2<T>
impl<T: Unit<Scalar = f64>> AddAssign<f64> for Vector2<T>
source§fn add_assign(&mut self, other: f64)
fn add_assign(&mut self, other: f64)
+=
operation. Read moresource§impl<T: Unit<Scalar = i32>> AddAssign<i32> for Vector2<T>
impl<T: Unit<Scalar = i32>> AddAssign<i32> for Vector2<T>
source§fn add_assign(&mut self, other: i32)
fn add_assign(&mut self, other: i32)
+=
operation. Read moresource§impl<T: Unit<Scalar = u32>> AddAssign<u32> for Vector2<T>
impl<T: Unit<Scalar = u32>> AddAssign<u32> for Vector2<T>
source§fn add_assign(&mut self, other: u32)
fn add_assign(&mut self, other: u32)
+=
operation. Read moresource§impl<T: Unit> AddAssign for Vector2<T>
impl<T: Unit> AddAssign for Vector2<T>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl<T> BorrowMut<DVec2> for Vector2<T>
impl<T> BorrowMut<DVec2> for Vector2<T>
source§fn borrow_mut(&mut self) -> &mut DVec2
fn borrow_mut(&mut self) -> &mut DVec2
source§impl<T> BorrowMut<I64Vec2> for Vector2<T>
impl<T> BorrowMut<I64Vec2> for Vector2<T>
source§fn borrow_mut(&mut self) -> &mut I64Vec2
fn borrow_mut(&mut self) -> &mut I64Vec2
source§impl<T> BorrowMut<IVec2> for Vector2<T>
impl<T> BorrowMut<IVec2> for Vector2<T>
source§fn borrow_mut(&mut self) -> &mut IVec2
fn borrow_mut(&mut self) -> &mut IVec2
source§impl<T> BorrowMut<U64Vec2> for Vector2<T>
impl<T> BorrowMut<U64Vec2> for Vector2<T>
source§fn borrow_mut(&mut self) -> &mut U64Vec2
fn borrow_mut(&mut self) -> &mut U64Vec2
source§impl<T> BorrowMut<UVec2> for Vector2<T>
impl<T> BorrowMut<UVec2> for Vector2<T>
source§fn borrow_mut(&mut self) -> &mut UVec2
fn borrow_mut(&mut self) -> &mut UVec2
source§impl<T> BorrowMut<Vec2> for Vector2<T>
impl<T> BorrowMut<Vec2> for Vector2<T>
source§fn borrow_mut(&mut self) -> &mut Vec2
fn borrow_mut(&mut self) -> &mut Vec2
source§impl<T> BorrowMut<Vector2<T>> for DVec2
impl<T> BorrowMut<Vector2<T>> for DVec2
source§fn borrow_mut(&mut self) -> &mut Vector2<T>
fn borrow_mut(&mut self) -> &mut Vector2<T>
source§impl<T> BorrowMut<Vector2<T>> for I64Vec2
impl<T> BorrowMut<Vector2<T>> for I64Vec2
source§fn borrow_mut(&mut self) -> &mut Vector2<T>
fn borrow_mut(&mut self) -> &mut Vector2<T>
source§impl<T> BorrowMut<Vector2<T>> for IVec2
impl<T> BorrowMut<Vector2<T>> for IVec2
source§fn borrow_mut(&mut self) -> &mut Vector2<T>
fn borrow_mut(&mut self) -> &mut Vector2<T>
source§impl<T> BorrowMut<Vector2<T>> for U64Vec2
impl<T> BorrowMut<Vector2<T>> for U64Vec2
source§fn borrow_mut(&mut self) -> &mut Vector2<T>
fn borrow_mut(&mut self) -> &mut Vector2<T>
source§impl<T> BorrowMut<Vector2<T>> for UVec2
impl<T> BorrowMut<Vector2<T>> for UVec2
source§fn borrow_mut(&mut self) -> &mut Vector2<T>
fn borrow_mut(&mut self) -> &mut Vector2<T>
source§impl<T> BorrowMut<Vector2<T>> for Vec2
impl<T> BorrowMut<Vector2<T>> for Vec2
source§fn borrow_mut(&mut self) -> &mut Vector2<T>
fn borrow_mut(&mut self) -> &mut Vector2<T>
source§impl<T: Unit<Scalar = f32>> DivAssign<f32> for Vector2<T>
impl<T: Unit<Scalar = f32>> DivAssign<f32> for Vector2<T>
source§fn div_assign(&mut self, other: f32)
fn div_assign(&mut self, other: f32)
/=
operation. Read moresource§impl<T: Unit<Scalar = f64>> DivAssign<f64> for Vector2<T>
impl<T: Unit<Scalar = f64>> DivAssign<f64> for Vector2<T>
source§fn div_assign(&mut self, other: f64)
fn div_assign(&mut self, other: f64)
/=
operation. Read moresource§impl<T: Unit<Scalar = i32>> DivAssign<i32> for Vector2<T>
impl<T: Unit<Scalar = i32>> DivAssign<i32> for Vector2<T>
source§fn div_assign(&mut self, other: i32)
fn div_assign(&mut self, other: i32)
/=
operation. Read moresource§impl<T: Unit<Scalar = u32>> DivAssign<u32> for Vector2<T>
impl<T: Unit<Scalar = u32>> DivAssign<u32> for Vector2<T>
source§fn div_assign(&mut self, other: u32)
fn div_assign(&mut self, other: u32)
/=
operation. Read moresource§impl<T: Unit> DivAssign for Vector2<T>
impl<T: Unit> DivAssign for Vector2<T>
source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
/=
operation. Read moresource§impl<T: Unit> IntoIterator for Vector2<T>
impl<T: Unit> IntoIterator for Vector2<T>
source§impl<T: Unit<Scalar = f32>> MulAssign<f32> for Vector2<T>
impl<T: Unit<Scalar = f32>> MulAssign<f32> for Vector2<T>
source§fn mul_assign(&mut self, other: f32)
fn mul_assign(&mut self, other: f32)
*=
operation. Read moresource§impl<T: Unit<Scalar = f64>> MulAssign<f64> for Vector2<T>
impl<T: Unit<Scalar = f64>> MulAssign<f64> for Vector2<T>
source§fn mul_assign(&mut self, other: f64)
fn mul_assign(&mut self, other: f64)
*=
operation. Read moresource§impl<T: Unit<Scalar = i32>> MulAssign<i32> for Vector2<T>
impl<T: Unit<Scalar = i32>> MulAssign<i32> for Vector2<T>
source§fn mul_assign(&mut self, other: i32)
fn mul_assign(&mut self, other: i32)
*=
operation. Read moresource§impl<T: Unit<Scalar = u32>> MulAssign<u32> for Vector2<T>
impl<T: Unit<Scalar = u32>> MulAssign<u32> for Vector2<T>
source§fn mul_assign(&mut self, other: u32)
fn mul_assign(&mut self, other: u32)
*=
operation. Read moresource§impl<T: Unit> MulAssign for Vector2<T>
impl<T: Unit> MulAssign for Vector2<T>
source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
*=
operation. Read moresource§impl<T: Unit> PartialEq<[<T as Unit>::Scalar; 2]> for Vector2<T>
impl<T: Unit> PartialEq<[<T as Unit>::Scalar; 2]> for Vector2<T>
source§impl<T: Unit> PartialEq<(<T as Unit>::Scalar, <T as Unit>::Scalar)> for Vector2<T>
impl<T: Unit> PartialEq<(<T as Unit>::Scalar, <T as Unit>::Scalar)> for Vector2<T>
source§impl<T: Unit> PartialEq for Vector2<T>
impl<T: Unit> PartialEq for Vector2<T>
source§impl<T: Unit> RelativeEq for Vector2<T>where
T::Scalar: RelativeEq,
impl<T: Unit> RelativeEq for Vector2<T>where
T::Scalar: RelativeEq,
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool
source§fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool
RelativeEq::relative_eq
.source§impl<T: Unit<Scalar = f32>> RemAssign<f32> for Vector2<T>
impl<T: Unit<Scalar = f32>> RemAssign<f32> for Vector2<T>
source§fn rem_assign(&mut self, other: f32)
fn rem_assign(&mut self, other: f32)
%=
operation. Read moresource§impl<T: Unit<Scalar = f64>> RemAssign<f64> for Vector2<T>
impl<T: Unit<Scalar = f64>> RemAssign<f64> for Vector2<T>
source§fn rem_assign(&mut self, other: f64)
fn rem_assign(&mut self, other: f64)
%=
operation. Read moresource§impl<T: Unit<Scalar = i32>> RemAssign<i32> for Vector2<T>
impl<T: Unit<Scalar = i32>> RemAssign<i32> for Vector2<T>
source§fn rem_assign(&mut self, other: i32)
fn rem_assign(&mut self, other: i32)
%=
operation. Read moresource§impl<T: Unit<Scalar = u32>> RemAssign<u32> for Vector2<T>
impl<T: Unit<Scalar = u32>> RemAssign<u32> for Vector2<T>
source§fn rem_assign(&mut self, other: u32)
fn rem_assign(&mut self, other: u32)
%=
operation. Read moresource§impl<T: Unit> RemAssign for Vector2<T>
impl<T: Unit> RemAssign for Vector2<T>
source§fn rem_assign(&mut self, other: Self)
fn rem_assign(&mut self, other: Self)
%=
operation. Read moresource§impl<T: Unit> SubAssign<Vector2<T>> for Box2<T>
impl<T: Unit> SubAssign<Vector2<T>> for Box2<T>
source§fn sub_assign(&mut self, rhs: Vector2<T>)
fn sub_assign(&mut self, rhs: Vector2<T>)
-=
operation. Read moresource§impl<T: Unit> SubAssign<Vector2<T>> for Point2<T>
impl<T: Unit> SubAssign<Vector2<T>> for Point2<T>
source§fn sub_assign(&mut self, other: Vector2<T>)
fn sub_assign(&mut self, other: Vector2<T>)
-=
operation. Read moresource§impl<T: Unit<Scalar = f32>> SubAssign<f32> for Vector2<T>
impl<T: Unit<Scalar = f32>> SubAssign<f32> for Vector2<T>
source§fn sub_assign(&mut self, other: f32)
fn sub_assign(&mut self, other: f32)
-=
operation. Read moresource§impl<T: Unit<Scalar = f64>> SubAssign<f64> for Vector2<T>
impl<T: Unit<Scalar = f64>> SubAssign<f64> for Vector2<T>
source§fn sub_assign(&mut self, other: f64)
fn sub_assign(&mut self, other: f64)
-=
operation. Read moresource§impl<T: Unit<Scalar = i32>> SubAssign<i32> for Vector2<T>
impl<T: Unit<Scalar = i32>> SubAssign<i32> for Vector2<T>
source§fn sub_assign(&mut self, other: i32)
fn sub_assign(&mut self, other: i32)
-=
operation. Read moresource§impl<T: Unit<Scalar = u32>> SubAssign<u32> for Vector2<T>
impl<T: Unit<Scalar = u32>> SubAssign<u32> for Vector2<T>
source§fn sub_assign(&mut self, other: u32)
fn sub_assign(&mut self, other: u32)
-=
operation. Read moresource§impl<T: Unit> SubAssign for Vector2<T>
impl<T: Unit> SubAssign for Vector2<T>
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-=
operation. Read moresource§impl<T: Unit> Swizzle<T> for Vector2<T>
impl<T: Unit> Swizzle<T> for Vector2<T>
source§fn swizzle2<const X: usize, const Y: usize>(&self) -> Vector2<T>
fn swizzle2<const X: usize, const Y: usize>(&self) -> Vector2<T>
source§impl<Src, Dst> TransformMap<Vector2<Src>> for Transform2<Src, Dst>
impl<Src, Dst> TransformMap<Vector2<Src>> for Transform2<Src, Dst>
source§impl<T: Unit> TransparentWrapper<<<T as Unit>::Scalar as Scalar>::Vec2> for Vector2<T>
impl<T: Unit> TransparentWrapper<<<T as Unit>::Scalar as Scalar>::Vec2> for Vector2<T>
SAFETY: These are guaranteed to have the same representation.
source§fn wrap_ref(s: &Inner) -> &Self
fn wrap_ref(s: &Inner) -> &Self
source§fn wrap_mut(s: &mut Inner) -> &mut Self
fn wrap_mut(s: &mut Inner) -> &mut Self
source§fn wrap_slice(s: &[Inner]) -> &[Self]where
Self: Sized,
fn wrap_slice(s: &[Inner]) -> &[Self]where
Self: Sized,
source§fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]where
Self: Sized,
fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]where
Self: Sized,
source§fn peel_ref(s: &Self) -> &Inner
fn peel_ref(s: &Self) -> &Inner
source§fn peel_mut(s: &mut Self) -> &mut Inner
fn peel_mut(s: &mut Self) -> &mut Inner
source§impl<T: Unit> UlpsEq for Vector2<T>
impl<T: Unit> UlpsEq for Vector2<T>
source§impl<T: Unit> Zeroable for Vector2<T>
impl<T: Unit> Zeroable for Vector2<T>
SAFETY: T::Scalar
is Zeroable
, and Vector2
is #[repr(C)]
.
impl<T: Unit> Copy for Vector2<T>
impl<T> Eq for Vector2<T>
impl<T: Unit> Pod for Vector2<T>
SAFETY: T::Scalar
is Pod
.
Auto Trait Implementations§
impl<T> Freeze for Vector2<T>
impl<T> RefUnwindSafe for Vector2<T>
impl<T> Send for Vector2<T>
impl<T> Sync for Vector2<T>
impl<T> Unpin for Vector2<T>
impl<T> UnwindSafe for Vector2<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.