[−][src]Struct gridly::prelude::Location
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
impl Location
[src]
#[must_use]pub fn new(row: impl Into<Row>, column: impl Into<Column>) -> Self
[src]
Create a new location out of a row
and a column
#[must_use]pub const fn zero() -> Self
[src]
Create a new location at (0, 0)
.
Trait Implementations
impl<T: VectorLike> Add<T> for Location
[src]
type Output = Location
The resulting type after applying the +
operator.
#[must_use]fn add(self, rhs: T) -> Location
[src]
impl<T: VectorLike> AddAssign<T> for Location
[src]
fn add_assign(&mut self, rhs: T)
[src]
impl Clone for Location
[src]
impl Copy for Location
[src]
impl Debug for Location
[src]
impl Default for Location
[src]
impl Eq for Location
[src]
impl Hash for Location
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl LocationLike for Location
[src]
#[must_use]fn row(&self) -> Row
[src]
#[must_use]fn column(&self) -> Column
[src]
#[must_use]fn as_location(&self) -> Location
[src]
#[must_use]fn get_component<T: Component>(&self) -> T
[src]
#[must_use]fn above(&self, distance: impl Into<Rows>) -> Location
[src]
#[must_use]fn below(&self, distance: impl Into<Rows>) -> Location
[src]
#[must_use]fn left(&self, distance: impl Into<Columns>) -> Location
[src]
#[must_use]fn right(&self, distance: impl Into<Columns>) -> Location
[src]
#[must_use]fn add(&self, distance: impl VectorLike) -> Location
[src]
#[must_use]fn relative(&self, direction: Direction, distance: isize) -> Location
[src]
#[must_use]fn step(&self, direction: Direction) -> Location
[src]
#[must_use]fn transpose(&self) -> Location
[src]
#[must_use]fn order_by<Major: Component>(self) -> Ordered<Self, Major>
[src]
#[must_use]fn row_ordered(self) -> RowOrdered<Self>
[src]
#[must_use]fn column_ordered(self) -> ColumnOrdered<Self>
[src]
impl<T: LocationLike> PartialEq<T> 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 Ordered
wrapper struct, which allows for row-major or column-major orderings.
#[must_use]fn partial_cmp(&self, rhs: &T) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Location
[src]
impl Sub<(Column, Row)> for Location
[src]
type Output = Vector
The resulting type after applying the -
operator.
#[must_use]fn sub(self, (column, row): (Column, Row)) -> Vector
[src]
impl Sub<(Row, Column)> for Location
[src]
type Output = Vector
The resulting type after applying the -
operator.
#[must_use]fn sub(self, (row, column): (Row, Column)) -> Vector
[src]
impl Sub<Location> for Location
[src]
type Output = Vector
The resulting type after applying the -
operator.
#[must_use]fn sub(self, rhs: Location) -> Vector
[src]
impl<T: VectorLike> Sub<T> for Location
[src]
type Output = Location
The resulting type after applying the -
operator.
#[must_use]fn sub(self, rhs: T) -> Location
[src]
impl<T: VectorLike> SubAssign<T> for Location
[src]
fn sub_assign(&mut self, rhs: T)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnwindSafe for Location
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>,