[−][src]Struct gridly::location::OrderedLocation
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]
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]
fn eq(&self, other: &OrderedLocation<Major>) -> bool
[src]
fn ne(&self, other: &OrderedLocation<Major>) -> bool
[src]
impl<M: Component> PartialOrd<OrderedLocation<M>> for OrderedLocation<M>
[src]
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
[src]
fn lt(&self, rhs: &Self) -> bool
[src]
fn le(&self, rhs: &Self) -> bool
[src]
fn gt(&self, rhs: &Self) -> bool
[src]
fn ge(&self, rhs: &Self) -> bool
[src]
impl<Major: Component> Ord for OrderedLocation<Major>
[src]
fn cmp(&self, rhs: &Self) -> Ordering
[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]
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]
fn clone(&self) -> 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]
fn default() -> OrderedLocation<Major>
[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<M: Component> DerefMut for OrderedLocation<M>
[src]
impl<M: Component> Deref for OrderedLocation<M>
[src]
impl<Major: Hash + Component> Hash for OrderedLocation<Major>
[src]
fn hash<__HMajor: Hasher>(&self, state: &mut __HMajor)
[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<Major: Debug + Component> Debug for OrderedLocation<Major>
[src]
Auto Trait Implementations
impl<Major> Send for OrderedLocation<Major> where
Major: Send,
Major: Send,
impl<Major> Sync for OrderedLocation<Major> where
Major: Sync,
Major: Sync,
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>,