pub struct Location {
pub row: Row,
pub column: Column,
}
Expand description
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 row count downward and increasing
columns count rightward.
Locations support arithmetic operations with Vector
s. They can also be
subtracted from each other to produce Vector
s measuring the distance
between them.
Fields§
§row: Row
§column: Column
Implementations§
Trait Implementations§
source§impl<T: VectorLike> Add<T> for Location
impl<T: VectorLike> Add<T> for Location
source§impl<T: VectorLike> AddAssign<T> for Location
impl<T: VectorLike> AddAssign<T> for Location
source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+=
operation. Read moresource§impl LocationLike for Location
impl LocationLike for Location
source§fn as_location(&self) -> Location
fn as_location(&self) -> Location
Location
struct.source§fn get_component<T: Component>(&self) -> T
fn get_component<T: Component>(&self) -> T
source§fn above(&self, distance: impl Into<Rows>) -> Location
fn above(&self, distance: impl Into<Rows>) -> Location
distance
rows above this one Read moresource§fn below(&self, distance: impl Into<Rows>) -> Location
fn below(&self, distance: impl Into<Rows>) -> Location
distance
rows below this one Read moresource§fn left(&self, distance: impl Into<Columns>) -> Location
fn left(&self, distance: impl Into<Columns>) -> Location
distance
columns to the left of this one Read moresource§fn right(&self, distance: impl Into<Columns>) -> Location
fn right(&self, distance: impl Into<Columns>) -> Location
distance
columns to the right of this one Read moresource§fn add(&self, distance: impl VectorLike) -> Location
fn add(&self, distance: impl VectorLike) -> Location
distance
away from this one.source§fn step(&self, direction: Direction) -> Location
fn step(&self, direction: Direction) -> Location
direction
Read moresource§fn order_by<Major: Component>(self) -> Ordered<Self, Major>
fn order_by<Major: Component>(self) -> Ordered<Self, Major>
Location
. The Major
is the ordering; for example, order_by::<Row>
will create a row-ordered
Location
. See row_ordered
or
column_ordered
for an example.source§fn row_ordered(self) -> RowOrdered<Self>
fn row_ordered(self) -> RowOrdered<Self>
Location
; that is, a
location which is ordered by comparing the row
, then the column
. Read moresource§fn column_ordered(self) -> ColumnOrdered<Self>
fn column_ordered(self) -> ColumnOrdered<Self>
Location
; that is, a
location which is ordered by comparing the row
, then the column
. Read moresource§fn span_over<C: VecComponent>(
self,
distance: C
) -> LocationRange<<C::Point as Component>::Converse> ⓘ
fn span_over<C: VecComponent>( self, distance: C ) -> LocationRange<<C::Point as Component>::Converse> ⓘ
source§impl<T: LocationLike> PartialEq<T> for Location
impl<T: LocationLike> PartialEq<T> for Location
source§impl<T: LocationLike> PartialOrd<T> for Location
impl<T: LocationLike> PartialOrd<T> for Location
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 Ordered
wrapper struct, which allows for row-major or column-major orderings.
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<T: VectorLike> Sub<T> for Location
impl<T: VectorLike> Sub<T> for Location
source§impl<T: VectorLike> SubAssign<T> for Location
impl<T: VectorLike> SubAssign<T> for Location
source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-=
operation. Read more