pub struct Point {
pub x: i32,
pub y: i32,
}
Expand description
Helper struct defining a 2D point in space.
Fields§
§x: i32
The point’s X location
y: i32
The point’s Y location
Implementations§
Source§impl Point
impl Point
Sourcepub const fn constant(x: i32, y: i32) -> Point
pub const fn constant(x: i32, y: i32) -> Point
Create a new point from i32, this can be constant
Sourcepub fn from_tuple<T>(t: (T, T)) -> Point
pub fn from_tuple<T>(t: (T, T)) -> Point
Create a point from a tuple of two i32s
Sourcepub fn to_unsigned_tuple(self) -> (usize, usize)
pub fn to_unsigned_tuple(self) -> (usize, usize)
Converts the point to a usize tuple
§Panics
This can panic if X or Y are not convertible to a usize
.
Trait Implementations§
Source§impl AddAssign for Point
impl AddAssign for Point
Source§fn add_assign(&mut self, other: Point)
fn add_assign(&mut self, other: Point)
Performs the
+=
operation. Read moreSource§impl DivAssign for Point
impl DivAssign for Point
Source§fn div_assign(&mut self, other: Point)
fn div_assign(&mut self, other: Point)
Performs the
/=
operation. Read moreSource§impl MulAssign for Point
impl MulAssign for Point
Source§fn mul_assign(&mut self, other: Point)
fn mul_assign(&mut self, other: Point)
Performs the
*=
operation. Read moreSource§impl SubAssign for Point
impl SubAssign for Point
Source§fn sub_assign(&mut self, other: Point)
fn sub_assign(&mut self, other: Point)
Performs the
-=
operation. Read moreimpl Copy for Point
impl Eq for Point
impl StructuralPartialEq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
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