Expand description
A set of 2 i32
s representing a location or direction in the 2d plane.
Fields
x: i32
The x component of the vector.
y: i32
The y component of the vector.
Implementations
sourceimpl Vec2Int
impl Vec2Int
sourcepub const fn new(x: i32, y: i32) -> Vec2Int
pub const fn new(x: i32, y: i32) -> Vec2Int
Creates a new Vec2
with the given x- and y-values.
It is often simpler, and preferred, to just write (x, y).into()
.
sourcepub fn sq_magnitude(self) -> i32
pub fn sq_magnitude(self) -> i32
Gets the squared magnitude of the vector.
Useful for comparisons as it is faster to calculate than magnitude
.
Trait Implementations
sourceimpl<T> AddAssign<T> for Vec2Int where
Vec2Int: Add<T, Output = Self>,
impl<T> AddAssign<T> for Vec2Int where
Vec2Int: Add<T, Output = Self>,
sourcefn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the +=
operation. Read more
sourceimpl DivAssign<i32> for Vec2Int
impl DivAssign<i32> for Vec2Int
sourcefn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
Performs the /=
operation. Read more
sourceimpl MulAssign<i32> for Vec2Int
impl MulAssign<i32> for Vec2Int
sourcefn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
Performs the *=
operation. Read more
sourceimpl<T> SubAssign<T> for Vec2Int where
Vec2Int: Sub<T, Output = Self>,
impl<T> SubAssign<T> for Vec2Int where
Vec2Int: Sub<T, Output = Self>,
sourcefn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the -=
operation. Read more
impl Copy for Vec2Int
impl Eq for Vec2Int
impl StructuralEq for Vec2Int
impl StructuralPartialEq for Vec2Int
Auto Trait Implementations
impl RefUnwindSafe for Vec2Int
impl Send for Vec2Int
impl Sync for Vec2Int
impl Unpin for Vec2Int
impl UnwindSafe for Vec2Int
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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