pub struct Coordinate {
pub row: usize,
pub column: usize,
}Expand description
Row-major coordinate.
let c = Coordinate::from ((1, 2));
assert_eq!(c.row, 1);
assert_eq!(c.column, 2);
let c = Coordinate::from ([1, 2]);
assert_eq!(c.row, 1);
assert_eq!(c.column, 2);
let a = Coordinate::from ((1, 2));
let b = Dimensions::from ((1, 1));
assert_eq!(a + b, (2, 3).into());
let a = Coordinate::from ((1, 2));
let b = Dimensions::from ((1, 1));
assert_eq!(a - b, (0, 1).into());Fields§
§row: usize§column: usizeTrait Implementations§
Source§impl Add<Dimensions> for Coordinate
impl Add<Dimensions> for Coordinate
Source§type Output = Coordinate
type Output = Coordinate
The resulting type after applying the
+ operator.Source§fn add(self, rhs: Dimensions) -> Coordinate
fn add(self, rhs: Dimensions) -> Coordinate
Performs the
+ operation. Read moreSource§impl Clone for Coordinate
impl Clone for Coordinate
Source§fn clone(&self) -> Coordinate
fn clone(&self) -> Coordinate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Coordinate
impl Debug for Coordinate
Source§impl Default for Coordinate
impl Default for Coordinate
Source§fn default() -> Coordinate
fn default() -> Coordinate
Returns the “default value” for a type. Read more
Source§impl From<Coordinate> for [usize; 2]
impl From<Coordinate> for [usize; 2]
Source§fn from(_: Coordinate) -> Self
fn from(_: Coordinate) -> Self
Converts to this type from the input type.
Source§impl From<Coordinate> for (usize, usize)
impl From<Coordinate> for (usize, usize)
Source§fn from(_: Coordinate) -> Self
fn from(_: Coordinate) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Coordinate
impl PartialEq for Coordinate
Source§impl Sub<Dimensions> for Coordinate
impl Sub<Dimensions> for Coordinate
Source§type Output = Coordinate
type Output = Coordinate
The resulting type after applying the
- operator.Source§fn sub(self, rhs: Dimensions) -> Coordinate
fn sub(self, rhs: Dimensions) -> Coordinate
Performs the
- operation. Read moreimpl Copy for Coordinate
impl Eq for Coordinate
impl StructuralPartialEq for Coordinate
Auto Trait Implementations§
impl Freeze for Coordinate
impl RefUnwindSafe for Coordinate
impl Send for Coordinate
impl Sync for Coordinate
impl Unpin for Coordinate
impl UnwindSafe for Coordinate
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