[−][src]Struct cogs_gamedev::int_coords::ICoord
Signed-int coordinates
Fields
x: isize
y: isize
Implementations
impl ICoord
[src]
pub fn new(x: isize, y: isize) -> Self
[src]
Create a new ICoord
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<ICoord> for ICoord
[src]
type Output = Self
The resulting type after applying the +
operator.
pub fn add(self, rhs: Self) -> Self::Output
[src]
impl AddAssign<ICoord> for ICoord
[src]
pub fn add_assign(&mut self, rhs: Self)
[src]
impl Clone for ICoord
[src]
impl Copy for ICoord
[src]
impl Debug for ICoord
[src]
impl Eq for ICoord
[src]
impl From<Coord> for ICoord
[src]
impl PartialEq<ICoord> for ICoord
[src]
impl StructuralEq for ICoord
[src]
impl StructuralPartialEq for ICoord
[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.
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,