#[repr(C)]pub struct Vector2<T> {
pub x: T,
pub y: T,
}Expand description
A vector containing two numeric values. This may represent a size or position.
Fields
x: TThe horizontal component of the vector.
y: TThe vertical component of the vector.
Implementations
sourceimpl<T: PrimitiveZero> Vector2<T>
impl<T: PrimitiveZero> Vector2<T>
sourceimpl Vector2<f32>
impl Vector2<f32>
sourcepub fn magnitude_squared(&self) -> f32
pub fn magnitude_squared(&self) -> f32
Returns the magnitude of the vector, squared.
sourceimpl<T: Neg<Output = T> + Copy> Vector2<T>
impl<T: Neg<Output = T> + Copy> Vector2<T>
sourcepub fn rotate_90_degrees_clockwise(&self) -> Vector2<T>
pub fn rotate_90_degrees_clockwise(&self) -> Vector2<T>
Rotates the vector by 90 degrees in the clockwise direction.
sourcepub fn rotate_90_degrees_anticlockwise(&self) -> Vector2<T>
pub fn rotate_90_degrees_anticlockwise(&self) -> Vector2<T>
Rotates the vector by 90 degrees in the anti-clockwise direction.
sourceimpl<T: AsPrimitive<f32>> Vector2<T>
impl<T: AsPrimitive<f32>> Vector2<T>
sourceimpl<T: AsPrimitive<i32>> Vector2<T>
impl<T: AsPrimitive<i32>> Vector2<T>
sourceimpl<T: AsPrimitive<u32>> Vector2<T>
impl<T: AsPrimitive<u32>> Vector2<T>
Trait Implementations
sourceimpl<T: PartialEq> PartialEq<Vector2<T>> for Vector2<T>
impl<T: PartialEq> PartialEq<Vector2<T>> for Vector2<T>
sourceimpl<T: RoundFloat> RoundFloat for Vector2<T>
impl<T: RoundFloat> RoundFloat for Vector2<T>
impl<T: Copy> Copy for Vector2<T>
impl<T: Eq> Eq for Vector2<T>
impl<T> StructuralEq for Vector2<T>
impl<T> StructuralPartialEq for Vector2<T>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more