[][src]Struct cogs_gamedev::int_coords::Coord

pub struct Coord {
    pub x: usize,
    pub y: usize,
}

Unsigned-int coordinates

Fields

x: usizey: usize

Implementations

impl Coord[src]

pub fn new(x: usize, y: usize) -> Self[src]

Make a new coord.

pub fn to_2d_idx(self, width: usize) -> usize[src]

Get this as an index into an array representing a 2d array.

(AKA, y * width + x.)

pub fn to_icoord(self) -> ICoord[src]

Convert this into an ICoord.

Trait Implementations

impl Add<Coord> for Coord[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<Coord> for Coord[src]

impl Clone for Coord[src]

impl Copy for Coord[src]

impl Debug for Coord[src]

impl Eq for Coord[src]

impl From<Coord> for ICoord[src]

impl Hash for Coord[src]

impl Mul<usize> for Coord[src]

type Output = Self

The resulting type after applying the * operator.

impl MulAssign<usize> for Coord[src]

impl PartialEq<Coord> for Coord[src]

impl StructuralEq for Coord[src]

impl StructuralPartialEq 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.

type Error = TryFromIntError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Coord

impl Send for Coord

impl Sync for Coord

impl Unpin for Coord

impl UnwindSafe for Coord

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.