#[repr(C)]pub struct Vector2u {
pub x: u32,
pub y: u32,
}Expand description
An owning representation of an unsigned 2-component Euclidean vector.
Like Vec2u, the Vector2u object represents a Euclidean vector in
2D. Unlike the Vec2u, this is an owning representation that stores the
actual content of the vector.
Fields§
§x: u32The X-component of the vector.
y: u32The Y-component of the vector.
Implementations§
source§impl Vector2u
impl Vector2u
sourcepub const ZERO: Vector2u = _
pub const ZERO: Vector2u = _
A constant for a Null vector, which has magnitude 0 and exists at the origin.
sourcepub const UNIT_X: Vector2u = _
pub const UNIT_X: Vector2u = _
A constant for a unit vector in the positive X-direction.
sourcepub const UNIT_Y: Vector2u = _
pub const UNIT_Y: Vector2u = _
A constant for a unit vector in the positive Y-direction.
sourcepub const fn new(x: u32, y: u32) -> Self
pub const fn new(x: u32, y: u32) -> Self
Constructs this vector from an x and y coordinate.
§Parameters
x- the x-componenty- the y-component
sourcepub const fn from_array(array: &[u32; 2]) -> Self
pub const fn from_array(array: &[u32; 2]) -> Self
sourcepub const fn from_slice(slice: &[u32]) -> Result<Self, VecError>
pub const fn from_slice(slice: &[u32]) -> Result<Self, VecError>
sourcepub const unsafe fn from_slice_unchecked(slice: &[u32]) -> Self
pub const unsafe fn from_slice_unchecked(slice: &[u32]) -> Self
sourcepub const fn from_vec2u(other: &Vec2u) -> Self
pub const fn from_vec2u(other: &Vec2u) -> Self
sourcepub fn as_mut_vec2u(&mut self) -> &mut Vec2u
pub fn as_mut_vec2u(&mut self) -> &mut Vec2u
Returns this vector as a mutable [Vec2].
sourcepub fn as_mut_slice(&mut self) -> &mut [u32]
pub fn as_mut_slice(&mut self) -> &mut [u32]
Returns this vector as a mutable slice of u32.
Methods from Deref<Target = Vec2u>§
sourcepub fn as_mut_slice(&mut self) -> &mut [u32]
pub fn as_mut_slice(&mut self) -> &mut [u32]
Returns this [Vec2] as a mutable slice of u32.
sourcepub fn as_mut_ptr(&mut self) -> *mut u32
pub fn as_mut_ptr(&mut self) -> *mut u32
Returns a mutable raw pointer to u32 of the vector’s buffer.
sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut u32>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut u32>
Returns a mutable iterator over the vector.
sourcepub fn x_mut(&mut self) -> &mut u32
pub fn x_mut(&mut self) -> &mut u32
Returns a mutable reference to the X-coordinate of this 2-component vector.
sourcepub fn y_mut(&mut self) -> &mut u32
pub fn y_mut(&mut self) -> &mut u32
Returns a mutable reference to the Y-coordinate of this 2-component vector.
sourcepub fn set(&mut self, other: &Vec2u)
pub fn set(&mut self, other: &Vec2u)
Sets all the components of this vector the values from other.
§Parameters
other- the other [Vec2] to set.
Trait Implementations§
source§impl AddAssign<&Vec2u> for Vector2u
impl AddAssign<&Vec2u> for Vector2u
source§fn add_assign(&mut self, rhs: &Vec2u)
fn add_assign(&mut self, rhs: &Vec2u)
+= operation. Read moresource§impl AddAssign<&Vector2u> for Vector2u
impl AddAssign<&Vector2u> for Vector2u
source§fn add_assign(&mut self, rhs: &Self)
fn add_assign(&mut self, rhs: &Self)
+= operation. Read moresource§impl AddAssign for Vector2u
impl AddAssign for Vector2u
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moresource§impl BorrowMut<Vec2u> for Vector2u
impl BorrowMut<Vec2u> for Vector2u
source§fn borrow_mut(&mut self) -> &mut Vec2u
fn borrow_mut(&mut self) -> &mut Vec2u
source§impl DivAssign<u32> for Vector2u
impl DivAssign<u32> for Vector2u
source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/= operation. Read moresource§impl MulAssign<u32> for Vector2u
impl MulAssign<u32> for Vector2u
source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*= operation. Read moresource§impl Ord for Vector2u
impl Ord for Vector2u
source§impl PartialOrd for Vector2u
impl PartialOrd for Vector2u
source§impl RemAssign<u32> for Vector2u
impl RemAssign<u32> for Vector2u
source§fn rem_assign(&mut self, rhs: u32)
fn rem_assign(&mut self, rhs: u32)
%= operation. Read moresource§impl SubAssign<&Vec2u> for Vector2u
impl SubAssign<&Vec2u> for Vector2u
source§fn sub_assign(&mut self, rhs: &Vec2u)
fn sub_assign(&mut self, rhs: &Vec2u)
-= operation. Read moresource§impl SubAssign<&Vector2u> for Vector2u
impl SubAssign<&Vector2u> for Vector2u
source§fn sub_assign(&mut self, rhs: &Self)
fn sub_assign(&mut self, rhs: &Self)
-= operation. Read moresource§impl SubAssign for Vector2u
impl SubAssign for Vector2u
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read moreimpl Copy for Vector2u
impl Eq for Vector2u
impl StructuralPartialEq for Vector2u
Auto Trait Implementations§
impl Freeze for Vector2u
impl RefUnwindSafe for Vector2u
impl Send for Vector2u
impl Sync for Vector2u
impl Unpin for Vector2u
impl UnwindSafe for Vector2u
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)