[−][src]Struct gridly::location::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. By convention, increasing rows count downward and increasing columns count rightward.
Locations support arithmetic operations with Vectors.
Fields
row: Row
column: Column
Methods
impl Location
[src]
pub fn new(row: impl Into<Row>, column: impl Into<Column>) -> Self
[src]
pub fn zero() -> Self
[src]
pub fn get_component<T: Component>(&self) -> T
[src]
Get either the row or column of a location
pub fn above(&self, distance: impl Into<Rows>) -> Location
[src]
Return the location that is distance
above this one
pub fn below(&self, distance: impl Into<Rows>) -> Location
[src]
Return the location that is distance
below this one
pub fn left(&self, distance: impl Into<Columns>) -> Location
[src]
Return the location that is distance
to the left of this one
pub fn right(&self, distance: impl Into<Columns>) -> Location
[src]
Return the location that is distance
to the right of this one
pub fn relative(&self, direction: Direction, distance: isize) -> Location
[src]
Return the location that is distance
away in the given direction
pub fn step(&self, direction: Direction) -> Location
[src]
Return the location that is 1 away in the given direction
pub fn transpose(&self) -> Location
[src]
Swap the row and colimn of this Location
pub fn order_by<Major: Component>(self) -> OrderedLocation<Major>
[src]
pub fn row_ordered(self) -> RowOrderedLocation
[src]
pub fn column_ordered(self) -> ColumnOrderedLocation
[src]
Trait Implementations
impl Copy for Location
[src]
impl PartialEq<Location> for Location
[src]
impl Eq for Location
[src]
impl<M: Component> AsMut<Location> for OrderedLocation<M>
[src]
impl Clone for Location
[src]
fn clone(&self) -> Location
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Location
[src]
impl<R: Into<Row>, C: Into<Column>> From<(R, C)> for Location
[src]
impl<M: Component> From<OrderedLocation<M>> for Location
[src]
fn from(ord: OrderedLocation<M>) -> Self
[src]
impl<M: Component> From<Location> for OrderedLocation<M>
[src]
impl<M: Component> AsRef<Location> for OrderedLocation<M>
[src]
impl Hash for Location
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
default fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Into<Vector>> Add<T> for Location
[src]
type Output = Location
The resulting type after applying the +
operator.
fn add(self, rhs: T) -> Location
[src]
impl<T: Into<Vector>> Sub<T> for Location
[src]
type Output = Location
The resulting type after applying the -
operator.
fn sub(self, rhs: T) -> Location
[src]
impl Sub<Location> for Location
[src]
type Output = Vector
The resulting type after applying the -
operator.
fn sub(self, rhs: Location) -> Vector
[src]
impl<T: Into<Vector>> AddAssign<T> for Location
[src]
fn add_assign(&mut self, rhs: T)
[src]
impl<T: Into<Vector>> SubAssign<T> for Location
[src]
fn sub_assign(&mut self, rhs: T)
[src]
impl Debug for Location
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,