pub struct Ordered<L: LocationLike, Major: Component> {
pub location: L,
/* private fields */
}
Expand description
Rules for ordering a location. This struct wraps a LocationLike
and
supplies an Ord
and PartialOrd
implementation. The Major
type parameter indicates which ordering is used; for instance,
Ordering<Row>
provides row-major ordering, where Locations are sorted
first by row, then by column.
Fields§
§location: L
Implementations§
Trait Implementations§
source§impl<L: LocationLike, M: Component> LocationLike for Ordered<L, M>
impl<L: LocationLike, M: Component> LocationLike for Ordered<L, M>
source§fn as_location(&self) -> Location
fn as_location(&self) -> Location
Convert this object into a
Location
struct.source§fn get_component<T: Component>(&self) -> T
fn get_component<T: Component>(&self) -> T
Get either the row or column of a location. This method is useful in
code that is generic over the Row or Column.
source§fn above(&self, distance: impl Into<Rows>) -> Location
fn above(&self, distance: impl Into<Rows>) -> Location
Return the location that is
distance
rows above this one Read moresource§fn below(&self, distance: impl Into<Rows>) -> Location
fn below(&self, distance: impl Into<Rows>) -> Location
Return the location that is
distance
rows below this one Read moresource§fn left(&self, distance: impl Into<Columns>) -> Location
fn left(&self, distance: impl Into<Columns>) -> Location
Return the location that is
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
Return the location that is
distance
columns to the right of this one Read moresource§fn add(&self, distance: impl VectorLike) -> Location
fn add(&self, distance: impl VectorLike) -> Location
Return the location that is
distance
away from this one.source§fn step(&self, direction: Direction) -> Location
fn step(&self, direction: Direction) -> Location
Return the location that is 1 away in the given
direction
Read moresource§fn order_by<Major: Component>(self) -> Ordered<Self, Major>
fn order_by<Major: Component>(self) -> Ordered<Self, Major>
Generically get strictly ordered version of this
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>
Get a strictly row-ordered version of this
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>
Get a strictly row-ordered version of this
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> ⓘ
Create a range, starting at this location, with the given length Read more
source§impl<L: LocationLike, M: Component> Ord for Ordered<L, M>
impl<L: LocationLike, M: Component> Ord for Ordered<L, M>
source§impl<L: LocationLike, M: Component, R: LocationLike> PartialEq<R> for Ordered<L, M>
impl<L: LocationLike, M: Component, R: LocationLike> PartialEq<R> for Ordered<L, M>
source§impl<L: LocationLike, M: Component> PartialOrd for Ordered<L, M>
impl<L: LocationLike, M: Component> PartialOrd for Ordered<L, M>
impl<L: Copy + LocationLike, Major: Copy + Component> Copy for Ordered<L, Major>
impl<L: LocationLike, M: Component> Eq for Ordered<L, M>
Auto Trait Implementations§
impl<L, Major> RefUnwindSafe for Ordered<L, Major>where
L: RefUnwindSafe,
Major: RefUnwindSafe,
impl<L, Major> Send for Ordered<L, Major>
impl<L, Major> Sync for Ordered<L, Major>
impl<L, Major> Unpin for Ordered<L, Major>
impl<L, Major> UnwindSafe for Ordered<L, Major>where
L: UnwindSafe,
Major: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more