[−][src]Trait gridly::location::component::Component
A component of a Location
This trait comprises a component of a Location
, which may be either a
Row
or a Column
. It is effectively an index into a given row or
column of a grid; for instance, a Row
can index a column in a grid.
Associated Types
type Converse: Component<Converse = Self>
type Distance: VecComponent
Required methods
fn from_location(location: &Location) -> Self
Get this component type from a Location
fn combine(self, other: Self::Converse) -> Location
Combine this component with its converse to create a Location
fn name() -> &'static str
Return the lowercase name of this component type– "row" or "column"
fn value(self) -> isize
Get the integer value of this component
fn add(self, amount: Self::Distance) -> Self
Add a distance to this component.
fn distance_from(self, origin: Self) -> Self::Distance
Find the distance between two components, using the other component as the origin
Provided methods
fn distance_to(self, target: Self) -> Self::Distance
Find the distance between two components, using this component as the origin
fn transpose(self) -> Self::Converse
Convert a Row into a Column or vice versa