[][src]Struct gridly::location::OrderedLocation

pub struct OrderedLocation<Major: Component> {
    pub location: Location,
    // some fields omitted
}

Rules for ordering a Location

OrderedLocation is a wrapper struct around a Location that 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: Location

Methods

impl<M: Component> OrderedLocation<M>[src]

pub fn new(location: Location) -> Self[src]

Methods from Deref<Target = Location>

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

Trait Implementations

impl<Major: Copy + Component> Copy for OrderedLocation<Major>[src]

impl<Major: PartialEq + Component> PartialEq<OrderedLocation<Major>> for OrderedLocation<Major>[src]

impl<M: Component> PartialOrd<OrderedLocation<M>> for OrderedLocation<M>[src]

impl<Major: Component> Ord for OrderedLocation<Major>[src]

default fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

default fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

default fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<Major: Eq + Component> Eq for OrderedLocation<Major>[src]

impl<M: Component> AsMut<Location> for OrderedLocation<M>[src]

impl<Major: Clone + Component> Clone for OrderedLocation<Major>[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<Major: Default + Component> Default for OrderedLocation<Major>[src]

impl<M: Component> From<OrderedLocation<M>> for Location[src]

impl<M: Component> From<Location> for OrderedLocation<M>[src]

impl<M: Component> AsRef<Location> for OrderedLocation<M>[src]

impl<M: Component> DerefMut for OrderedLocation<M>[src]

impl<M: Component> Deref for OrderedLocation<M>[src]

type Target = Location

The resulting type after dereferencing.

impl<Major: Hash + Component> Hash for OrderedLocation<Major>[src]

default fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<Major: Debug + Component> Debug for OrderedLocation<Major>[src]

Auto Trait Implementations

impl<Major> Send for OrderedLocation<Major> where
    Major: Send

impl<Major> Sync for OrderedLocation<Major> where
    Major: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.