[][src]Struct gridly::location::Location

pub struct Location {
    pub row: Row,
    pub column: Column,
}

A location on a grid

A location is the primary indexing type for a Grid, and represents a single cell on that grid. It is comprised of a Row and a Column. Increasing rows count downward and increasing columns count rightward.

Locations support arithmetic operations with Vectors.

Fields

row: Rowcolumn: Column

Methods

impl Location[src]

pub fn new(row: impl Into<Row>, column: impl Into<Column>) -> Self[src]

Create a new location out of a row and a column

pub const fn zero() -> Self[src]

Create a new location at (0, 0).

Trait Implementations

impl LocationLike for Location[src]

impl Eq for Location[src]

impl Default for Location[src]

impl Clone for Location[src]

impl<T: LocationLike> PartialOrd<T> for Location[src]

Locations have a partial ordering. loc1 is considered greater than loc2 iff its row or its column are greater than those in loc2. This chart shows an example:

<<<??
<<<??
<<=>>
??>>>
??>>>

Cells marked > are considered greater than the center location (marked =), and cells marked '<' are less than the center location. Cells marked ? do not have an ordering with the center location.

For a strict ordering between all possible locations, see the OrderedLocation wrapper struct, which allows for row-major or column-major orderings.

impl<T: LocationLike> PartialEq<T> for Location[src]

impl Copy for Location[src]

impl Hash for Location[src]

impl<T: VectorLike> Add<T> for Location[src]

type Output = Location

The resulting type after applying the + operator.

impl<T: VectorLike> Sub<T> for Location[src]

type Output = Location

The resulting type after applying the - operator.

impl Sub<Location> for Location[src]

type Output = Vector

The resulting type after applying the - operator.

impl<T: VectorLike> AddAssign<T> for Location[src]

impl<T: VectorLike> SubAssign<T> for Location[src]

impl Debug for Location[src]

Auto Trait Implementations

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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.

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

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

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