Struct cogs_gamedev::grids::coords::ICoord [−][src]
Expand description
Signed-int coordinates
Fields
x: isizey: isizeImplementations
impl ICoord[src]
impl ICoord[src]pub fn quadrant(self) -> usize[src]
pub fn quadrant(self) -> usize[src]Return the quadrant this coordinate is in.
- 1: +X, +Y
- 2: -X, +Y
- 3: -X, -Y
- 4: +X, -Y
Zeroes are treated as positive.
assert_eq!(ICoord::new(4, 5).quadrant(), 1); assert_eq!(ICoord::new(-3, -2).quadrant(), 3); // Zero is treated as positive assert_eq!(ICoord::new(0, -8).quadrant(), 4); assert_eq!(ICoord::new(0, 0).quadrant(), 1);
Trait Implementations
impl Add<Direction4> for ICoord[src]
impl Add<Direction4> for ICoord[src]impl Add<Direction8> for ICoord[src]
impl Add<Direction8> for ICoord[src]impl AddAssign<Direction4> for ICoord[src]
impl AddAssign<Direction4> for ICoord[src]fn add_assign(&mut self, rhs: Direction4)[src]
fn add_assign(&mut self, rhs: Direction4)[src]Performs the += operation. Read more
impl AddAssign<Direction8> for ICoord[src]
impl AddAssign<Direction8> for ICoord[src]fn add_assign(&mut self, rhs: Direction8)[src]
fn add_assign(&mut self, rhs: Direction8)[src]Performs the += operation. Read more
impl AddAssign<ICoord> for ICoord[src]
impl AddAssign<ICoord> for ICoord[src]fn add_assign(&mut self, rhs: Self)[src]
fn add_assign(&mut self, rhs: Self)[src]Performs the += operation. Read more
impl MulAssign<isize> for ICoord[src]
impl MulAssign<isize> for ICoord[src]fn mul_assign(&mut self, rhs: isize)[src]
fn mul_assign(&mut self, rhs: isize)[src]Performs the *= operation. Read more
impl TryFrom<ICoord> for Coord[src]
impl TryFrom<ICoord> for Coord[src]Try to convert an ICoord to a Coord. Will return Error if the ICoord has any negatives in it.
impl Copy for ICoord[src]
impl Eq for ICoord[src]
impl StructuralEq for ICoord[src]
impl StructuralPartialEq for ICoord[src]
Auto Trait Implementations
impl RefUnwindSafe for ICoord
impl Send for ICoord
impl Sync for ICoord
impl Unpin for ICoord
impl UnwindSafe for ICoord
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,