pub struct Vec2Int {
pub x: i32,
pub y: i32,
}Expand description
A set of 2 i32s representing a location or direction in the 2d plane.
Fields§
§x: i32The x component of the vector.
y: i32The y component of the vector.
Implementations§
Source§impl 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§
Source§impl<T> AddAssign<T> for Vec2Int
impl<T> AddAssign<T> for Vec2Int
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read moreSource§impl DivAssign<i32> for Vec2Int
impl DivAssign<i32> for Vec2Int
Source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
Performs the
/= operation. Read moreSource§impl MulAssign<i32> for Vec2Int
impl MulAssign<i32> for Vec2Int
Source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
Performs the
*= operation. Read moreSource§impl<T> SubAssign<T> for Vec2Int
impl<T> SubAssign<T> for Vec2Int
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-= operation. Read moreimpl Copy for Vec2Int
impl Eq for Vec2Int
impl StructuralPartialEq for Vec2Int
Auto Trait Implementations§
impl Freeze for Vec2Int
impl RefUnwindSafe for Vec2Int
impl Send for Vec2Int
impl Sync for Vec2Int
impl Unpin for Vec2Int
impl UnwindSafe for Vec2Int
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
Mutably borrows from an owned value. Read more